Create SubLink nodes in parser for Vadim.
This commit is contained in:
parent
691dc282f8
commit
588867bd7b
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.65 1998/01/15 18:59:56 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.66 1998/01/19 05:06:13 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -53,7 +53,7 @@ List *extras = NIL;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
QueryTreeList *
|
QueryTreeList *
|
||||||
parse_analyze(List *pl)
|
parse_analyze(List *pl, ParseState *parentParseState)
|
||||||
{
|
{
|
||||||
QueryTreeList *result;
|
QueryTreeList *result;
|
||||||
ParseState *pstate;
|
ParseState *pstate;
|
||||||
|
@ -65,7 +65,7 @@ parse_analyze(List *pl)
|
||||||
|
|
||||||
while (pl != NIL)
|
while (pl != NIL)
|
||||||
{
|
{
|
||||||
pstate = make_parsestate();
|
pstate = make_parsestate(parentParseState);
|
||||||
result->qtrees[i++] = transformStmt(pstate, lfirst(pl));
|
result->qtrees[i++] = transformStmt(pstate, lfirst(pl));
|
||||||
if (extras != NIL)
|
if (extras != NIL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.93 1998/01/17 05:01:34 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.94 1998/01/19 05:06:15 momjian Exp $
|
||||||
*
|
*
|
||||||
* HISTORY
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
static char saved_relname[NAMEDATALEN]; /* need this for complex attributes */
|
static char saved_relname[NAMEDATALEN]; /* need this for complex attributes */
|
||||||
static bool QueryIsRule = FALSE;
|
static bool QueryIsRule = FALSE;
|
||||||
static Node *saved_In_Expr;
|
static List *saved_In_Expr = NIL;
|
||||||
static Oid *param_type_info;
|
static Oid *param_type_info;
|
||||||
static int pfunc_num_args;
|
static int pfunc_num_args;
|
||||||
extern List *parsetree;
|
extern List *parsetree;
|
||||||
|
@ -242,7 +242,7 @@ Oid param_type(int t); /* used in parse_expr.c */
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Keywords (in SQL92 reserved words) */
|
/* Keywords (in SQL92 reserved words) */
|
||||||
%token ACTION, ADD, ALL, ALTER, AND, AS, ASC,
|
%token ACTION, ADD, ALL, ALTER, AND, ANY AS, ASC,
|
||||||
BEGIN_TRANS, BETWEEN, BOTH, BY,
|
BEGIN_TRANS, BETWEEN, BOTH, BY,
|
||||||
CASCADE, CAST, CHAR, CHARACTER, CHECK, CLOSE, COLLATE, COLUMN, COMMIT,
|
CASCADE, CAST, CHAR, CHARACTER, CHECK, CLOSE, COLLATE, COLUMN, COMMIT,
|
||||||
CONSTRAINT, CREATE, CROSS, CURRENT, CURRENT_DATE, CURRENT_TIME,
|
CONSTRAINT, CREATE, CROSS, CURRENT, CURRENT_DATE, CURRENT_TIME,
|
||||||
|
@ -2871,7 +2871,9 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')'
|
||||||
{
|
{
|
||||||
SubLink *n = makeNode(SubLink);
|
SubLink *n = makeNode(SubLink);
|
||||||
n->lefthand = $2;
|
n->lefthand = $2;
|
||||||
n->subLinkType = IN_SUBLINK;
|
n->oper = lcons("=",NIL);
|
||||||
|
n->useor = false;
|
||||||
|
n->subLinkType = ANY_SUBLINK;
|
||||||
n->subselect = $6;
|
n->subselect = $6;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
|
@ -2879,7 +2881,29 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')'
|
||||||
{
|
{
|
||||||
SubLink *n = makeNode(SubLink);
|
SubLink *n = makeNode(SubLink);
|
||||||
n->lefthand = $2;
|
n->lefthand = $2;
|
||||||
n->subLinkType = NOTIN_SUBLINK;
|
n->oper = lcons("<>",NIL);
|
||||||
|
n->useor = true;
|
||||||
|
n->subLinkType = ALL_SUBLINK;
|
||||||
|
n->subselect = $7;
|
||||||
|
$$ = (Node *)n;
|
||||||
|
}
|
||||||
|
| '(' row_descriptor ')' Op ANY '(' SubSelect ')'
|
||||||
|
{
|
||||||
|
SubLink *n = makeNode(SubLink);
|
||||||
|
n->lefthand = $2;
|
||||||
|
n->oper = lcons($4,NIL);
|
||||||
|
n->useor = false;
|
||||||
|
n->subLinkType = ANY_SUBLINK;
|
||||||
|
n->subselect = $7;
|
||||||
|
$$ = (Node *)n;
|
||||||
|
}
|
||||||
|
| '(' row_descriptor ')' Op ALL '(' SubSelect ')'
|
||||||
|
{
|
||||||
|
SubLink *n = makeNode(SubLink);
|
||||||
|
n->lefthand = $2;
|
||||||
|
n->oper = lcons($4,NIL);
|
||||||
|
n->useor = false;
|
||||||
|
n->subLinkType = ALL_SUBLINK;
|
||||||
n->subselect = $7;
|
n->subselect = $7;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
|
@ -2887,8 +2911,12 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')'
|
||||||
{
|
{
|
||||||
SubLink *n = makeNode(SubLink);
|
SubLink *n = makeNode(SubLink);
|
||||||
n->lefthand = $2;
|
n->lefthand = $2;
|
||||||
n->subLinkType = OPER_SUBLINK;
|
|
||||||
n->oper = lcons($4, NIL);
|
n->oper = lcons($4, NIL);
|
||||||
|
if (strcmp($4,"<>") == 0)
|
||||||
|
n->useor = true;
|
||||||
|
else
|
||||||
|
n->useor = false;
|
||||||
|
n->subLinkType = EXPR_SUBLINK;
|
||||||
n->subselect = $6;
|
n->subselect = $6;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
|
@ -3114,17 +3142,13 @@ a_expr: attr opt_indirection
|
||||||
n->args = NIL;
|
n->args = NIL;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
/* We probably need to define an "exists" node,
|
|
||||||
* since the optimizer could choose to find only one match.
|
|
||||||
* Perhaps the first implementation could just check for
|
|
||||||
* count(*) > 0? - thomas 1997-07-19
|
|
||||||
*/
|
|
||||||
| EXISTS '(' SubSelect ')'
|
| EXISTS '(' SubSelect ')'
|
||||||
{
|
{
|
||||||
SubLink *n = makeNode(SubLink);
|
SubLink *n = makeNode(SubLink);
|
||||||
n->lefthand = NIL;
|
n->lefthand = NIL;
|
||||||
n->subLinkType = EXISTS_SUBLINK;
|
n->useor = false;
|
||||||
n->oper = NIL;
|
n->oper = NIL;
|
||||||
|
n->subLinkType = EXISTS_SUBLINK;
|
||||||
n->subselect = $3;
|
n->subselect = $3;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
|
@ -3239,26 +3263,52 @@ a_expr: attr opt_indirection
|
||||||
makeA_Expr(OP, "<", $1, $4),
|
makeA_Expr(OP, "<", $1, $4),
|
||||||
makeA_Expr(OP, ">", $1, $6));
|
makeA_Expr(OP, ">", $1, $6));
|
||||||
}
|
}
|
||||||
| a_expr IN { saved_In_Expr = $1; } '(' in_expr ')'
|
| a_expr IN { saved_In_Expr = lcons($1,saved_In_Expr); } '(' in_expr ')' { saved_In_Expr = lnext(saved_In_Expr); }
|
||||||
{
|
{
|
||||||
if (nodeTag($5) == T_SubLink)
|
if (nodeTag($5) == T_SubLink)
|
||||||
{
|
{
|
||||||
((SubLink *)$5)->lefthand = lcons($1, NIL);
|
SubLink *n = (SubLink *)$5;
|
||||||
((SubLink *)$5)->subLinkType = IN_SUBLINK;
|
n->lefthand = lcons($1, NIL);
|
||||||
$$ = (Node *)$5;
|
n->oper = lcons("=",NIL);
|
||||||
|
n->useor = false;
|
||||||
|
n->subLinkType = ANY_SUBLINK;
|
||||||
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
else $$ = $5;
|
else $$ = $5;
|
||||||
}
|
}
|
||||||
| a_expr NOT IN { saved_In_Expr = $1; } '(' not_in_expr ')'
|
| a_expr NOT IN { saved_In_Expr = lcons($1,saved_In_Expr); } '(' not_in_expr ')' { saved_In_Expr = lnext(saved_In_Expr); }
|
||||||
{
|
{
|
||||||
if (nodeTag($6) == T_SubLink)
|
if (nodeTag($6) == T_SubLink)
|
||||||
{
|
{
|
||||||
((SubLink *)$6)->lefthand = lcons($1, NIL);
|
SubLink *n = (SubLink *)$6;
|
||||||
((SubLink *)$6)->subLinkType = NOTIN_SUBLINK;
|
n->lefthand = lcons($1, NIL);
|
||||||
$$ = (Node *)$6;
|
n->oper = lcons("<>",NIL);
|
||||||
|
n->useor = false;
|
||||||
|
n->subLinkType = ALL_SUBLINK;
|
||||||
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
else $$ = $6;
|
else $$ = $6;
|
||||||
}
|
}
|
||||||
|
| a_expr Op ANY '(' SubSelect ')'
|
||||||
|
{
|
||||||
|
SubLink *n = makeNode(SubLink);
|
||||||
|
n->lefthand = lcons($1,NIL);
|
||||||
|
n->oper = lcons($2,NIL);
|
||||||
|
n->useor = false;
|
||||||
|
n->subLinkType = ANY_SUBLINK;
|
||||||
|
n->subselect = $5;
|
||||||
|
$$ = (Node *)n;
|
||||||
|
}
|
||||||
|
| a_expr Op ALL '(' SubSelect ')'
|
||||||
|
{
|
||||||
|
SubLink *n = makeNode(SubLink);
|
||||||
|
n->lefthand = lcons($1, NULL);
|
||||||
|
n->oper = lcons($2,NIL);
|
||||||
|
n->useor = false;
|
||||||
|
n->subLinkType = ALL_SUBLINK;
|
||||||
|
n->subselect = $5;
|
||||||
|
$$ = (Node *)n;
|
||||||
|
}
|
||||||
| a_expr AND a_expr
|
| a_expr AND a_expr
|
||||||
{ $$ = makeA_Expr(AND, NULL, $1, $3); }
|
{ $$ = makeA_Expr(AND, NULL, $1, $3); }
|
||||||
| a_expr OR a_expr
|
| a_expr OR a_expr
|
||||||
|
@ -3480,10 +3530,10 @@ in_expr: SubSelect
|
||||||
;
|
;
|
||||||
|
|
||||||
in_expr_nodes: AexprConst
|
in_expr_nodes: AexprConst
|
||||||
{ $$ = makeA_Expr(OP, "=", saved_In_Expr, $1); }
|
{ $$ = makeA_Expr(OP, "=", lfirst(saved_In_Expr), $1); }
|
||||||
| in_expr_nodes ',' AexprConst
|
| in_expr_nodes ',' AexprConst
|
||||||
{ $$ = makeA_Expr(OR, NULL, $1,
|
{ $$ = makeA_Expr(OR, NULL, $1,
|
||||||
makeA_Expr(OP, "=", saved_In_Expr, $3));
|
makeA_Expr(OP, "=", lfirst(saved_In_Expr), $3));
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -3498,10 +3548,10 @@ not_in_expr: SubSelect
|
||||||
;
|
;
|
||||||
|
|
||||||
not_in_expr_nodes: AexprConst
|
not_in_expr_nodes: AexprConst
|
||||||
{ $$ = makeA_Expr(OP, "<>", saved_In_Expr, $1); }
|
{ $$ = makeA_Expr(OP, "<>", lfirst(saved_In_Expr), $1); }
|
||||||
| not_in_expr_nodes ',' AexprConst
|
| not_in_expr_nodes ',' AexprConst
|
||||||
{ $$ = makeA_Expr(AND, NULL, $1,
|
{ $$ = makeA_Expr(AND, NULL, $1,
|
||||||
makeA_Expr(OP, "<>", saved_In_Expr, $3));
|
makeA_Expr(OP, "<>", lfirst(saved_In_Expr), $3));
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.29 1998/01/05 03:32:22 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.30 1998/01/19 05:06:16 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -39,6 +39,7 @@ static ScanKeyword ScanKeywords[] = {
|
||||||
{"alter", ALTER},
|
{"alter", ALTER},
|
||||||
{"analyze", ANALYZE},
|
{"analyze", ANALYZE},
|
||||||
{"and", AND},
|
{"and", AND},
|
||||||
|
{"any", ANY},
|
||||||
{"append", APPEND},
|
{"append", APPEND},
|
||||||
{"archive", ARCHIVE},
|
{"archive", ARCHIVE},
|
||||||
{"as", AS},
|
{"as", AS},
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.8 1998/01/06 23:58:05 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.9 1998/01/19 05:06:17 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -387,7 +387,7 @@ transformUnionClause(List *unionClause, List *targetlist)
|
||||||
|
|
||||||
if (unionClause)
|
if (unionClause)
|
||||||
{
|
{
|
||||||
qlist = parse_analyze(unionClause);
|
qlist = parse_analyze(unionClause, NULL);
|
||||||
|
|
||||||
for (i=0; i < qlist->len; i++)
|
for (i=0; i < qlist->len; i++)
|
||||||
union_list = lappend(union_list, qlist->qtrees[i]);
|
union_list = lappend(union_list, qlist->qtrees[i]);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.7 1998/01/16 23:20:18 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.8 1998/01/19 05:06:18 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
#include "nodes/params.h"
|
#include "nodes/params.h"
|
||||||
#include "nodes/relation.h"
|
#include "nodes/relation.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
|
#include "parser/analyze.h"
|
||||||
#include "parser/gramparse.h"
|
#include "parser/gramparse.h"
|
||||||
#include "parser/parse_expr.h"
|
#include "parser/parse_expr.h"
|
||||||
#include "parser/parse_func.h"
|
#include "parser/parse_func.h"
|
||||||
|
@ -249,6 +250,42 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
|
||||||
precedence);
|
precedence);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case T_SubLink:
|
||||||
|
{
|
||||||
|
SubLink *sublink = (SubLink *) expr;
|
||||||
|
QueryTreeList *qtree;
|
||||||
|
Query *subselect;
|
||||||
|
|
||||||
|
qtree = parse_analyze(lcons(sublink->subselect,NIL), pstate);
|
||||||
|
|
||||||
|
Assert(qtree->len == 1);
|
||||||
|
|
||||||
|
sublink->subselect = (Node *) subselect = qtree->qtrees[0];
|
||||||
|
|
||||||
|
if (length(sublink->lefthand) !=
|
||||||
|
length(subselect->targetList))
|
||||||
|
elog(ERROR,"Subselect has too many or too few fields.");
|
||||||
|
|
||||||
|
if (sublink->subLinkType != EXISTS_SUBLINK)
|
||||||
|
{
|
||||||
|
char *op = lfirst(sublink->oper);
|
||||||
|
List *left_expr = sublink->lefthand;
|
||||||
|
List *right_expr = subselect->targetList;
|
||||||
|
List *elist;
|
||||||
|
|
||||||
|
foreach(elist, left_expr)
|
||||||
|
{
|
||||||
|
Node *lexpr = transformExpr(pstate, lfirst(elist), precedence);
|
||||||
|
Node *rexpr = lfirst(right_expr);
|
||||||
|
Expr *op_expr;
|
||||||
|
|
||||||
|
op_expr = make_op(op, lexpr, rexpr);
|
||||||
|
sublink->oper = lappend(sublink->oper, op_expr->oper);
|
||||||
|
right_expr = lnext(right_expr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
/* should not reach here */
|
/* should not reach here */
|
||||||
elog(ERROR, "transformExpr: does not know how to transform node %d",
|
elog(ERROR, "transformExpr: does not know how to transform node %d",
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.7 1998/01/17 04:53:19 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.8 1998/01/19 05:06:19 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +42,7 @@ static Node *make_operand(char *opname,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ParseState *
|
ParseState *
|
||||||
make_parsestate(void)
|
make_parsestate(ParseState *parentParseState)
|
||||||
{
|
{
|
||||||
ParseState *pstate;
|
ParseState *pstate;
|
||||||
|
|
||||||
|
@ -50,7 +50,8 @@ make_parsestate(void)
|
||||||
MemSet(pstate, 0, sizeof(ParseState));
|
MemSet(pstate, 0, sizeof(ParseState));
|
||||||
|
|
||||||
pstate->p_last_resno = 1;
|
pstate->p_last_resno = 1;
|
||||||
|
pstate->parentParseState = parentParseState;
|
||||||
|
|
||||||
return (pstate);
|
return (pstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.31 1997/12/22 05:42:25 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.32 1998/01/19 05:06:20 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -61,7 +61,7 @@ parser(char *str, Oid *typev, int nargs)
|
||||||
if (yyresult) /* error */
|
if (yyresult) /* error */
|
||||||
return ((QueryTreeList *) NULL);
|
return ((QueryTreeList *) NULL);
|
||||||
|
|
||||||
queryList = parse_analyze(parsetree);
|
queryList = parse_analyze(parsetree, NULL);
|
||||||
|
|
||||||
#ifdef SETS_FIXED
|
#ifdef SETS_FIXED
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: primnodes.h,v 1.13 1998/01/17 04:53:42 momjian Exp $
|
* $Id: primnodes.h,v 1.14 1998/01/19 05:06:36 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -281,8 +281,7 @@ typedef struct Aggreg
|
||||||
*/
|
*/
|
||||||
typedef enum SubLinkType
|
typedef enum SubLinkType
|
||||||
{
|
{
|
||||||
EXISTS_SUBLINK, ALL_SUBLINK, ANY_SUBLINK, EXPR_SUBLINK,
|
EXISTS_SUBLINK, ALL_SUBLINK, ANY_SUBLINK, EXPR_SUBLINK
|
||||||
IN_SUBLINK, NOTIN_SUBLINK, OPER_SUBLINK
|
|
||||||
} SubLinkType;
|
} SubLinkType;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: analyze.h,v 1.2 1997/11/26 01:13:56 momjian Exp $
|
* $Id: analyze.h,v 1.3 1998/01/19 05:06:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -14,6 +14,6 @@
|
||||||
|
|
||||||
#include <parser/parse_node.h>
|
#include <parser/parse_node.h>
|
||||||
|
|
||||||
extern QueryTreeList *parse_analyze(List *pl);
|
extern QueryTreeList *parse_analyze(List *pl, ParseState *parentParseState);
|
||||||
|
|
||||||
#endif /* ANALYZE_H */
|
#endif /* ANALYZE_H */
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: parse_node.h,v 1.5 1998/01/17 04:53:46 momjian Exp $
|
* $Id: parse_node.h,v 1.6 1998/01/19 05:06:41 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -28,9 +28,11 @@ typedef struct QueryTreeList
|
||||||
/* state information used during parse analysis */
|
/* state information used during parse analysis */
|
||||||
typedef struct ParseState
|
typedef struct ParseState
|
||||||
{
|
{
|
||||||
|
struct ParseState;
|
||||||
int p_last_resno;
|
int p_last_resno;
|
||||||
List *p_rtable;
|
List *p_rtable;
|
||||||
List *p_insert_columns;
|
List *p_insert_columns;
|
||||||
|
struct ParseState *parentParseState;
|
||||||
bool p_hasAggs;
|
bool p_hasAggs;
|
||||||
bool p_hasSubLinks;
|
bool p_hasSubLinks;
|
||||||
bool p_is_insert;
|
bool p_is_insert;
|
||||||
|
@ -41,7 +43,7 @@ typedef struct ParseState
|
||||||
RangeTblEntry *p_target_rangetblentry;
|
RangeTblEntry *p_target_rangetblentry;
|
||||||
} ParseState;
|
} ParseState;
|
||||||
|
|
||||||
extern ParseState *make_parsestate(void);
|
extern ParseState *make_parsestate(ParseState *parentParseState);
|
||||||
extern Expr *make_op(char *opname, Node *ltree, Node *rtree);
|
extern Expr *make_op(char *opname, Node *ltree, Node *rtree);
|
||||||
extern Var *make_var(ParseState *pstate, char *refname, char *attrname, Oid *type_id);
|
extern Var *make_var(ParseState *pstate, char *refname, char *attrname, Oid *type_id);
|
||||||
extern ArrayRef *make_array_ref(Node *expr,
|
extern ArrayRef *make_array_ref(Node *expr,
|
||||||
|
|
Loading…
Reference in New Issue