1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-28 11:55:03 +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

@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* $Id: explain.c,v 1.52 2000/01/26 05:56:13 momjian Exp $
* $Id: explain.c,v 1.53 2000/02/15 03:36:39 thomas Exp $
*
*/
@@ -230,12 +230,12 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
RangeTblEntry *rte = nth(((Scan *) plan)->scanrelid - 1, es->rtable);
appendStringInfo(str, " on ");
if (strcmp(rte->refname, rte->relname) != 0)
if (strcmp(rte->ref->relname, rte->relname) != 0)
{
appendStringInfo(str, "%s ",
stringStringInfo(rte->relname));
}
appendStringInfo(str, stringStringInfo(rte->refname));
appendStringInfo(str, stringStringInfo(rte->ref->relname));
}
break;
case T_TidScan:
@@ -244,12 +244,12 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
RangeTblEntry *rte = nth(((TidScan *) plan)->scan.scanrelid - 1, es->rtable);
appendStringInfo(str, " on ");
if (strcmp(rte->refname, rte->relname) != 0)
if (strcmp(rte->ref->relname, rte->relname) != 0)
{
appendStringInfo(str, "%s ",
stringStringInfo(rte->relname));
}
appendStringInfo(str, stringStringInfo(rte->refname));
appendStringInfo(str, stringStringInfo(rte->ref->relname));
}
break;
default:

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: view.c,v 1.41 2000/01/26 05:56:14 momjian Exp $
* $Id: view.c,v 1.42 2000/02/15 03:36:39 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,6 +17,7 @@
#include "catalog/heap.h"
#include "commands/creatinh.h"
#include "commands/view.h"
#include "nodes/makefuncs.h"
#include "parser/parse_relation.h"
#include "parser/parse_type.h"
#include "rewrite/rewriteDefine.h"
@@ -225,9 +226,11 @@ UpdateRangeTableOfViewParse(char *viewName, Query *viewParse)
* create the 2 new range table entries and form the new range
* table... CURRENT first, then NEW....
*/
rt_entry1 = addRangeTableEntry(NULL, (char *) viewName, "*CURRENT*",
rt_entry1 = addRangeTableEntry(NULL, (char *) viewName,
makeAttr("*CURRENT*", NULL),
FALSE, FALSE, FALSE);
rt_entry2 = addRangeTableEntry(NULL, (char *) viewName, "*NEW*",
rt_entry2 = addRangeTableEntry(NULL, (char *) viewName,
makeAttr("*NEW*", NULL),
FALSE, FALSE, FALSE);
new_rt = lcons(rt_entry2, old_rt);
new_rt = lcons(rt_entry1, new_rt);