mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Inheritance overhaul by Chris Bitmead <chris@bitmead.com>
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.80 2000/05/30 00:49:47 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.81 2000/06/09 01:44:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -106,6 +106,9 @@ planner(Query *parse)
|
||||
Plan *
|
||||
subquery_planner(Query *parse, double tuple_fraction)
|
||||
{
|
||||
List *l;
|
||||
List *rangetable = parse->rtable;
|
||||
RangeTblEntry *rangeTblEntry;
|
||||
|
||||
/*
|
||||
* A HAVING clause without aggregates is equivalent to a WHERE clause
|
||||
@ -138,6 +141,18 @@ subquery_planner(Query *parse, double tuple_fraction)
|
||||
parse->qual = eval_const_expressions(parse->qual);
|
||||
parse->havingQual = eval_const_expressions(parse->havingQual);
|
||||
|
||||
/*
|
||||
* If the query is going to look for subclasses, but no subclasses
|
||||
* actually exist, then we can optimise away the union that would
|
||||
* otherwise happen and thus save some time.
|
||||
*/
|
||||
foreach(l, rangetable)
|
||||
{
|
||||
rangeTblEntry = (RangeTblEntry *)lfirst(l);
|
||||
if (rangeTblEntry->inh && !has_subclass(rangeTblEntry->relid))
|
||||
rangeTblEntry->inh = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Canonicalize the qual, and convert it to implicit-AND format.
|
||||
*
|
||||
|
Reference in New Issue
Block a user