FIx hasSubLinks for Vadim.
This commit is contained in:
parent
33c34920ff
commit
b20fd6c42d
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.68 1998/01/20 22:11:51 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.69 1998/02/06 16:46:28 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -217,7 +217,8 @@ transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt)
|
||||||
|
|
||||||
/* fix where clause */
|
/* fix where clause */
|
||||||
qry->qual = transformWhereClause(pstate, stmt->whereClause);
|
qry->qual = transformWhereClause(pstate, stmt->whereClause);
|
||||||
|
qry->hasSubLinks = pstate->p_hasSubLinks;
|
||||||
|
|
||||||
qry->rtable = pstate->p_rtable;
|
qry->rtable = pstate->p_rtable;
|
||||||
qry->resultRelation = refnameRangeTablePosn(pstate, stmt->relname, NULL);
|
qry->resultRelation = refnameRangeTablePosn(pstate, stmt->relname, NULL);
|
||||||
|
|
||||||
|
@ -317,7 +318,8 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
|
||||||
|
|
||||||
/* fix where clause */
|
/* fix where clause */
|
||||||
qry->qual = transformWhereClause(pstate, stmt->whereClause);
|
qry->qual = transformWhereClause(pstate, stmt->whereClause);
|
||||||
|
qry->hasSubLinks = pstate->p_hasSubLinks;
|
||||||
|
|
||||||
/* now the range table will not change */
|
/* now the range table will not change */
|
||||||
qry->rtable = pstate->p_rtable;
|
qry->rtable = pstate->p_rtable;
|
||||||
qry->resultRelation = refnameRangeTablePosn(pstate, stmt->relname, NULL);
|
qry->resultRelation = refnameRangeTablePosn(pstate, stmt->relname, NULL);
|
||||||
|
@ -664,18 +666,20 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
|
||||||
static Query *
|
static Query *
|
||||||
transformIndexStmt(ParseState *pstate, IndexStmt *stmt)
|
transformIndexStmt(ParseState *pstate, IndexStmt *stmt)
|
||||||
{
|
{
|
||||||
Query *q;
|
Query *qry;
|
||||||
|
|
||||||
q = makeNode(Query);
|
qry = makeNode(Query);
|
||||||
q->commandType = CMD_UTILITY;
|
qry->commandType = CMD_UTILITY;
|
||||||
|
|
||||||
/* take care of the where clause */
|
/* take care of the where clause */
|
||||||
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
|
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
|
||||||
|
qry->hasSubLinks = pstate->p_hasSubLinks;
|
||||||
|
|
||||||
stmt->rangetable = pstate->p_rtable;
|
stmt->rangetable = pstate->p_rtable;
|
||||||
|
|
||||||
q->utilityStmt = (Node *) stmt;
|
qry->utilityStmt = (Node *) stmt;
|
||||||
|
|
||||||
return q;
|
return qry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -686,17 +690,19 @@ transformIndexStmt(ParseState *pstate, IndexStmt *stmt)
|
||||||
static Query *
|
static Query *
|
||||||
transformExtendStmt(ParseState *pstate, ExtendStmt *stmt)
|
transformExtendStmt(ParseState *pstate, ExtendStmt *stmt)
|
||||||
{
|
{
|
||||||
Query *q;
|
Query *qry;
|
||||||
|
|
||||||
q = makeNode(Query);
|
qry = makeNode(Query);
|
||||||
q->commandType = CMD_UTILITY;
|
qry->commandType = CMD_UTILITY;
|
||||||
|
|
||||||
/* take care of the where clause */
|
/* take care of the where clause */
|
||||||
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
|
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
|
||||||
|
qry->hasSubLinks = pstate->p_hasSubLinks;
|
||||||
|
|
||||||
stmt->rangetable = pstate->p_rtable;
|
stmt->rangetable = pstate->p_rtable;
|
||||||
|
|
||||||
q->utilityStmt = (Node *) stmt;
|
qry->utilityStmt = (Node *) stmt;
|
||||||
return q;
|
return qry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -707,11 +713,11 @@ transformExtendStmt(ParseState *pstate, ExtendStmt *stmt)
|
||||||
static Query *
|
static Query *
|
||||||
transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
|
transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
|
||||||
{
|
{
|
||||||
Query *q;
|
Query *qry;
|
||||||
List *actions;
|
List *actions;
|
||||||
|
|
||||||
q = makeNode(Query);
|
qry = makeNode(Query);
|
||||||
q->commandType = CMD_UTILITY;
|
qry->commandType = CMD_UTILITY;
|
||||||
|
|
||||||
actions = stmt->actions;
|
actions = stmt->actions;
|
||||||
|
|
||||||
|
@ -740,9 +746,10 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
|
||||||
|
|
||||||
/* take care of the where clause */
|
/* take care of the where clause */
|
||||||
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
|
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
|
||||||
|
qry->hasSubLinks = pstate->p_hasSubLinks;
|
||||||
|
|
||||||
q->utilityStmt = (Node *) stmt;
|
qry->utilityStmt = (Node *) stmt;
|
||||||
return q;
|
return qry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -769,6 +776,7 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
|
||||||
qry->targetList = transformTargetList(pstate, stmt->targetList);
|
qry->targetList = transformTargetList(pstate, stmt->targetList);
|
||||||
|
|
||||||
qry->qual = transformWhereClause(pstate, stmt->whereClause);
|
qry->qual = transformWhereClause(pstate, stmt->whereClause);
|
||||||
|
qry->hasSubLinks = pstate->p_hasSubLinks;
|
||||||
|
|
||||||
qry->sortClause = transformSortClause(pstate,
|
qry->sortClause = transformSortClause(pstate,
|
||||||
stmt->sortClause,
|
stmt->sortClause,
|
||||||
|
@ -813,6 +821,7 @@ transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
|
||||||
qry->targetList = transformTargetList(pstate, stmt->targetList);
|
qry->targetList = transformTargetList(pstate, stmt->targetList);
|
||||||
|
|
||||||
qry->qual = transformWhereClause(pstate, stmt->whereClause);
|
qry->qual = transformWhereClause(pstate, stmt->whereClause);
|
||||||
|
qry->hasSubLinks = pstate->p_hasSubLinks;
|
||||||
|
|
||||||
qry->rtable = pstate->p_rtable;
|
qry->rtable = pstate->p_rtable;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.16 1998/02/05 17:22:29 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.17 1998/02/06 16:46:29 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -243,11 +243,13 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
|
||||||
SubLink *sublink = (SubLink *) expr;
|
SubLink *sublink = (SubLink *) expr;
|
||||||
QueryTreeList *qtree;
|
QueryTreeList *qtree;
|
||||||
List *llist;
|
List *llist;
|
||||||
|
|
||||||
|
pstate->p_hasSubLinks = true;
|
||||||
|
|
||||||
qtree = parse_analyze(lcons(sublink->subselect,NIL), pstate);
|
qtree = parse_analyze(lcons(sublink->subselect,NIL), pstate);
|
||||||
Assert(qtree->len == 1);
|
Assert(qtree->len == 1);
|
||||||
sublink->subselect = (Node *) qtree->qtrees[0];
|
sublink->subselect = (Node *) qtree->qtrees[0];
|
||||||
|
|
||||||
foreach(llist, sublink->lefthand)
|
foreach(llist, sublink->lefthand)
|
||||||
lfirst(llist) = transformExpr(pstate, lfirst(llist), precedence);
|
lfirst(llist) = transformExpr(pstate, lfirst(llist), precedence);
|
||||||
|
|
||||||
|
@ -267,7 +269,7 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
|
||||||
{
|
{
|
||||||
Node *lexpr = lfirst(elist);
|
Node *lexpr = lfirst(elist);
|
||||||
Node *rexpr = lfirst(right_expr);
|
Node *rexpr = lfirst(right_expr);
|
||||||
TargetEntry *tent = (TargetEntry *)rexpr;
|
TargetEntry *tent = (TargetEntry *)rexpr;
|
||||||
Expr *op_expr;
|
Expr *op_expr;
|
||||||
|
|
||||||
op_expr = make_op(op, lexpr, tent->expr);
|
op_expr = make_op(op, lexpr, tent->expr);
|
||||||
|
|
Loading…
Reference in New Issue