aboutsummaryrefslogtreecommitdiff
path: root/src/include/nodes/primnodes.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-02-14 21:35:07 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-02-14 21:35:07 +0000
commit4a66f9dd54694eb4d7ecce2c7e0f0c50dfde88cd (patch)
tree8810441569d5cf2e29f2a5c2b67ceb91d74deb2d /src/include/nodes/primnodes.h
parentd42d31e78e2f9db73edb0b0ed35cafb1c409bdbf (diff)
downloadpostgresql-4a66f9dd54694eb4d7ecce2c7e0f0c50dfde88cd.tar.gz
postgresql-4a66f9dd54694eb4d7ecce2c7e0f0c50dfde88cd.zip
Change scoping of table and join refnames to conform to SQL92: a JOIN
clause with an alias is a <subquery> and therefore hides table references appearing within it, according to the spec. This is the same as the preliminary patch I posted to pgsql-patches yesterday, plus some really grotty code in ruleutils.c to reverse-list a query tree with the correct alias name depending on context. I'd rather not have done that, but unless we want to force another initdb for 7.1, there's no other way for now.
Diffstat (limited to 'src/include/nodes/primnodes.h')
-rw-r--r--src/include/nodes/primnodes.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 2ca40e8ceca..f5cd6ea461d 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: primnodes.h,v 1.51 2001/01/24 19:43:26 momjian Exp $
+ * $Id: primnodes.h,v 1.52 2001/02/14 21:35:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,7 +29,7 @@ typedef struct FunctionCache *FunctionCachePtr;
* ----------------------------------------------------------------
*/
-/*
+/*--------------------
* Resdom (Result Domain)
*
* Notes:
@@ -50,7 +50,7 @@ typedef struct FunctionCache *FunctionCachePtr;
*
* Both reskey and reskeyop are typically zero during parse/plan stages.
* The executor does not pay any attention to ressortgroupref.
- *
+ *--------------------
*/
typedef struct Resdom
{
@@ -129,7 +129,6 @@ typedef struct Expr
* 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
#define OUTER 65001
@@ -153,7 +152,7 @@ typedef struct Var
AttrNumber varoattno; /* original value of varattno */
} Var;
-/*
+/*--------------------
* Oper
*
* NOTE: in the good old days 'opno' used to be both (or either, or
@@ -169,7 +168,7 @@ typedef struct Var
* Note also that opid is not necessarily filled in immediately on creation
* of the node. The planner makes sure it is valid before passing the node
* tree to the executor, but during parsing/planning opid is typically 0.
- *
+ *--------------------
*/
typedef struct Oper
{
@@ -499,10 +498,14 @@ typedef struct RangeTblRef
* are not equivalent to ON() since they also affect the output column list.
*
* alias is an Attr node representing the AS alias-clause attached to the
- * join expression, or NULL if no clause. During parse analysis, colnames
- * is filled with a list of String nodes giving the column names (real or
- * alias) of the output of the join, and colvars is filled with a list of
- * expressions that can be copied to reference the output columns.
+ * join expression, or NULL if no clause. NB: presence or absence of the
+ * alias has a critical impact on semantics, because a join with an alias
+ * restricts visibility of the tables/columns inside it.
+ *
+ * During parse analysis, colnames is filled with a list of String nodes
+ * giving the column names (real or alias) of the output of the join,
+ * and colvars is filled with a list of expressions that can be copied to
+ * reference the output columns.
*----------
*/
typedef struct JoinExpr