*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.88 1998/09/25 13:36:00 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.89 1998/10/28 16:06:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static Query *transformCursorStmt(ParseState *pstate, SelectStmt *stmt);
static Query *transformCreateStmt(ParseState *pstate, CreateStmt *stmt);
-List *extras = NIL;
+List *extras_before = NIL;
+List *extras_after = NIL;
/*
* parse_analyze -
{
QueryTreeList *result;
ParseState *pstate;
+ Query *parsetree;
int i = 0;
result = malloc(sizeof(QueryTreeList));
while (pl != NIL)
{
pstate = make_parsestate(parentParseState);
- result->qtrees[i++] = transformStmt(pstate, lfirst(pl));
+ parsetree = transformStmt(pstate, lfirst(pl));
if (pstate->p_target_relation != NULL)
heap_close(pstate->p_target_relation);
- if (extras != NIL)
+ if (extras_before != NIL)
{
- result->len += length(extras);
+ result->len += length(extras_before);
result->qtrees = (Query **) realloc(result->qtrees, result->len * sizeof(Query *));
- while (extras != NIL)
+ while (extras_before != NIL)
{
- result->qtrees[i++] = transformStmt(pstate, lfirst(extras));
+ result->qtrees[i++] = transformStmt(pstate, lfirst(extras_before));
if (pstate->p_target_relation != NULL)
heap_close(pstate->p_target_relation);
- extras = lnext(extras);
+ extras_before = lnext(extras_before);
}
}
- extras = NIL;
+ extras_before = NIL;
+
+ result->qtrees[i++] = parsetree;
+
+ if (extras_after != NIL)
+ {
+ result->len += length(extras_after);
+ result->qtrees = (Query **) realloc(result->qtrees, result->len * sizeof(Query *));
+ while (extras_after != NIL)
+ {
+ result->qtrees[i++] = transformStmt(pstate, lfirst(extras_after));
+ if (pstate->p_target_relation != NULL)
+ heap_close(pstate->p_target_relation);
+ extras_after = lnext(extras_after);
+ }
+ }
+ extras_after = NIL;
+
pl = lnext(pl);
pfree(pstate);
}
Constraint *constraint;
List *keys;
Ident *key;
+ List *blist = NIL;
List *ilist = NIL;
IndexStmt *index;
IndexElem *iparam;
elog(NOTICE, "CREATE TABLE will create implicit sequence %s for SERIAL column %s.%s",
sequence->seqname, stmt->relname, column->colname);
- ilist = lcons(sequence, NIL);
+ blist = lcons(sequence, NIL);
}
if (column->constraints != NIL)
}
q->utilityStmt = (Node *) stmt;
- extras = ilist;
+ extras_before = blist;
+ extras_after = ilist;
return q;
}