mirror of
https://github.com/postgres/postgres.git
synced 2025-11-16 15:02:33 +03:00
Further planner/optimizer cleanups. Move all set_tlist_references
and fix_opids processing to a single recursive pass over the plan tree executed at the very tail end of planning, rather than haphazardly here and there at different places. Now that tlist Vars do not get modified until the very end, it's possible to get rid of the klugy var_equal and match_varid partial-matching routines, and just use plain equal() throughout the optimizer. This is a step towards allowing merge and hash joins to be done on expressions instead of only Vars ...
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: primnodes.h,v 1.34 1999/08/21 03:49:09 tgl Exp $
|
||||
* $Id: primnodes.h,v 1.35 1999/08/22 20:15:00 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -120,15 +120,23 @@ typedef struct Expr
|
||||
/* ----------------
|
||||
* Var
|
||||
* varno - index of this var's relation in the range table
|
||||
* (could be INNER or OUTER)
|
||||
* (could also be INNER or OUTER)
|
||||
* varattno - attribute number of this var, or zero for all
|
||||
* vartype - pg_type tuple oid for the type of this var
|
||||
* vartype - pg_type tuple OID for the type of this var
|
||||
* vartypmod - pg_attribute typmod value
|
||||
* varlevelsup - for subquery variables referencing outer relations
|
||||
* varnoold - keep varno around in case it got changed to INNER/
|
||||
* OUTER (see match_varid)
|
||||
* varoattno - attribute number of this var
|
||||
* [ '(varnoold varoattno) was varid -ay 2/95]
|
||||
* varlevelsup - for subquery variables referencing outer relations;
|
||||
* 0 in a normal var, >0 means N levels up
|
||||
* varnoold - original value of varno
|
||||
* varoattno - original value of varattno
|
||||
*
|
||||
* Note: during parsing/planning, varnoold/varoattno are always just copies
|
||||
* of varno/varattno. At the tail end of planning, Var nodes appearing in
|
||||
* upper-level plan nodes are reassigned to point to the outputs of their
|
||||
* subplans; for example, in a join node varno becomes INNER or OUTER and
|
||||
* varattno becomes the index of the proper element of that subplan's target
|
||||
* list. But varnoold/varoattno continue to hold the original values.
|
||||
* The code doesn't really need varnoold/varoattno, but they are very useful
|
||||
* for debugging and interpreting completed plans, so we keep them around.
|
||||
* ----------------
|
||||
*/
|
||||
#define INNER 65000
|
||||
@@ -145,8 +153,8 @@ typedef struct Var
|
||||
Oid vartype;
|
||||
int32 vartypmod;
|
||||
Index varlevelsup; /* erased by upper optimizer */
|
||||
Index varnoold; /* only used by optimizer */
|
||||
AttrNumber varoattno; /* only used by optimizer */
|
||||
Index varnoold; /* mainly for debugging --- see above */
|
||||
AttrNumber varoattno;
|
||||
} Var;
|
||||
|
||||
/* ----------------
|
||||
|
||||
Reference in New Issue
Block a user