1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Carry column aliases from the parser frontend. Enables queries like

SELECT a FROM t1 tx (a);
Allow join syntax, including queries like
  SELECT * FROM t1 NATURAL JOIN t2;
Update RTE structure to hold column aliases in an Attr structure.
This commit is contained in:
Thomas G. Lockhart
2000-02-15 03:38:29 +00:00
parent 92c8437d8d
commit a344a6e7b5
27 changed files with 1102 additions and 324 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.59 2000/02/07 04:40:57 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.60 2000/02/15 03:37:08 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -95,6 +95,17 @@ _equalExpr(Expr *a, Expr *b)
return true;
}
static bool
_equalAttr(Attr *a, Attr *b)
{
if (!strcmp(a->relname, b->relname))
return false;
if (length(a->attrs) != length(b->attrs))
return false;
return equal(a->attrs, b->attrs);
}
static bool
_equalVar(Var *a, Var *b)
{
@@ -633,14 +644,14 @@ _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b)
if (a->relname != b->relname)
return false;
}
if (a->refname && b->refname)
if (a->ref && b->ref)
{
if (strcmp(a->refname, b->refname) != 0)
if (! equal(a->ref, b->ref))
return false;
}
else
{
if (a->refname != b->refname)
if (a->ref != b->ref)
return false;
}
if (a->relid != b->relid)
@@ -845,6 +856,9 @@ equal(void *a, void *b)
case T_EState:
retval = _equalEState(a, b);
break;
case T_Attr:
retval = _equalAttr(a, b);
break;
case T_Integer:
case T_String:
case T_Float: