diff options
| author | Thomas G. Lockhart | 2000-02-15 03:38:29 +0000 |
|---|---|---|
| committer | Thomas G. Lockhart | 2000-02-15 03:38:29 +0000 |
| commit | a344a6e7b5d7b2b87f33a155c3ef88bdfdce3fd8 (patch) | |
| tree | 78c19baad416cfe014237bc726baff63aff2b150 /src/include/parser | |
| parent | 92c8437d8de8efeb5324fcccb0175beec8e66619 (diff) | |
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.
Diffstat (limited to 'src/include/parser')
| -rw-r--r-- | src/include/parser/parse_clause.h | 7 | ||||
| -rw-r--r-- | src/include/parser/parse_node.h | 11 | ||||
| -rw-r--r-- | src/include/parser/parse_relation.h | 21 | ||||
| -rw-r--r-- | src/include/parser/parsetree.h | 6 |
4 files changed, 27 insertions, 18 deletions
diff --git a/src/include/parser/parse_clause.h b/src/include/parser/parse_clause.h index 235a02bc4c2..58b8fc60fa4 100644 --- a/src/include/parser/parse_clause.h +++ b/src/include/parser/parse_clause.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parse_clause.h,v 1.15 2000/01/27 18:11:47 tgl Exp $ + * $Id: parse_clause.h,v 1.16 2000/02/15 03:38:28 thomas Exp $ * *------------------------------------------------------------------------- */ @@ -16,10 +16,9 @@ #include "parser/parse_node.h" -extern void makeRangeTable(ParseState *pstate, List *frmList, Node **qual); +extern void makeRangeTable(ParseState *pstate, List *frmList); extern void setTargetTable(ParseState *pstate, char *relname); -extern Node *transformWhereClause(ParseState *pstate, Node *where, - Node *using); +extern Node *transformWhereClause(ParseState *pstate, Node *where); extern List *transformGroupClause(ParseState *pstate, List *grouplist, List *targetlist); extern List *transformSortClause(ParseState *pstate, List *orderlist, diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h index 4ba502ebaf3..16641b530a2 100644 --- a/src/include/parser/parse_node.h +++ b/src/include/parser/parse_node.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parse_node.h,v 1.17 2000/01/26 05:58:27 momjian Exp $ + * $Id: parse_node.h,v 1.18 2000/02/15 03:38:29 thomas Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,11 @@ #include "nodes/parsenodes.h" #include "utils/rel.h" -/* state information used during parse analysis */ +/* State information used during parse analysis + * p_join_quals is a list of qualification expressions + * found in the FROM clause. Needs to be available later + * to merge with other qualifiers from the WHERE clause. + */ typedef struct ParseState { int p_last_resno; @@ -30,6 +34,9 @@ typedef struct ParseState bool p_in_where_clause; Relation p_target_relation; RangeTblEntry *p_target_rangetblentry; + List *p_shape; + List *p_alias; + Node *p_join_quals; } ParseState; extern ParseState *make_parsestate(ParseState *parentParseState); diff --git a/src/include/parser/parse_relation.h b/src/include/parser/parse_relation.h index b9fe0b1b778..5ba5db3f9d0 100644 --- a/src/include/parser/parse_relation.h +++ b/src/include/parser/parse_relation.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parse_relation.h,v 1.14 2000/01/26 05:58:27 momjian Exp $ + * $Id: parse_relation.h,v 1.15 2000/02/15 03:38:29 thomas Exp $ * *------------------------------------------------------------------------- */ @@ -18,17 +18,20 @@ extern RangeTblEntry *refnameRangeTableEntry(ParseState *pstate, char *refname); extern int refnameRangeTablePosn(ParseState *pstate, - char *refname, int *sublevels_up); + char *refname, + int *sublevels_up); extern RangeTblEntry *colnameRangeTableEntry(ParseState *pstate, char *colname); extern RangeTblEntry *addRangeTableEntry(ParseState *pstate, - char *relname, - char *refname, - bool inh, - bool inFromCl, - bool inJoinSet); -extern List *expandAll(ParseState *pstate, char *relname, char *refname, - int *this_resno); + char *relname, + Attr *ref, + bool inh, + bool inFromCl, + bool inJoinSet); +extern Attr *expandTable(ParseState *pstate, char *refname, bool getaliases); +extern List *expandAll(ParseState *pstate, char *relname, Attr *ref, + int *this_resno); extern int attnameAttNum(Relation rd, char *a); +extern int specialAttNum(char *a); extern bool attnameIsSet(Relation rd, char *name); extern int attnumAttNelems(Relation rd, int attid); extern Oid attnumTypeId(Relation rd, int attid); diff --git a/src/include/parser/parsetree.h b/src/include/parser/parsetree.h index 979ebf327e8..3f5e09cc1df 100644 --- a/src/include/parser/parsetree.h +++ b/src/include/parser/parsetree.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parsetree.h,v 1.8 2000/01/26 05:58:27 momjian Exp $ + * $Id: parsetree.h,v 1.9 2000/02/15 03:38:29 thomas Exp $ * *------------------------------------------------------------------------- */ @@ -39,8 +39,8 @@ */ #define rt_relname(rt_entry) \ - ((!strcmp(((rt_entry)->refname),"*CURRENT*") ||\ - !strcmp(((rt_entry)->refname),"*NEW*")) ? ((rt_entry)->refname) : \ + ((!strcmp(((rt_entry)->ref->relname),"*CURRENT*") ||\ + !strcmp(((rt_entry)->ref->relname),"*NEW*")) ? ((rt_entry)->ref->relname) : \ ((char *)(rt_entry)->relname)) /* |
