Index: src/backend/commands/explain.c =================================================================== RCS file: /cvs/cvsfiles/devo/pgsql/src/backend/commands/explain.c,v retrieving revision 1.12.2.1 diff -c -p -r1.12.2.1 explain.c *** explain.c 2002/02/19 16:09:19 1.12.2.1 --- explain.c 2002/02/20 01:25:53 *************** ExplainOneQuery(Query *query, bool verbo *** 123,129 **** plan->instrument = InstrAlloc(); gettimeofday(&starttime, NULL); ! ProcessQuery(query, plan, None); CommandCounterIncrement(); gettimeofday(&endtime, NULL); --- 123,129 ---- plan->instrument = InstrAlloc(); gettimeofday(&starttime, NULL); ! ProcessQuery(query, plan, None, NULL); CommandCounterIncrement(); gettimeofday(&endtime, NULL); Index: src/backend/nodes/copyfuncs.c =================================================================== RCS file: /cvs/cvsfiles/devo/pgsql/src/backend/nodes/copyfuncs.c,v retrieving revision 1.13 diff -c -p -r1.13 copyfuncs.c *** copyfuncs.c 2002/02/04 20:59:22 1.13 --- copyfuncs.c 2002/02/20 01:25:53 *************** copyObject(void *from) *** 2889,2894 **** --- 2889,2898 ---- case T_CheckPointStmt: retval = (void *) makeNode(CheckPointStmt); break; + case T_CreateAsStmt: + retval = _copySelectStmt(from); + ((CreateAsStmt *)retval)->type = T_CreateAsStmt; + break; case T_A_Expr: retval = _copyAExpr(from); Index: src/backend/nodes/equalfuncs.c =================================================================== RCS file: /cvs/cvsfiles/devo/pgsql/src/backend/nodes/equalfuncs.c,v retrieving revision 1.13 diff -c -p -r1.13 equalfuncs.c *** equalfuncs.c 2002/02/04 20:59:22 1.13 --- equalfuncs.c 2002/02/20 01:25:53 *************** equal(void *a, void *b) *** 2039,2044 **** --- 2039,2047 ---- case T_CheckPointStmt: retval = true; break; + case T_CreateAsStmt: + retval = _equalSelectStmt(a, b); + break; case T_A_Expr: retval = _equalAExpr(a, b); Index: src/backend/parser/analyze.c =================================================================== RCS file: /cvs/cvsfiles/devo/pgsql/src/backend/parser/analyze.c,v retrieving revision 1.14.2.1 diff -c -p -r1.14.2.1 analyze.c *** analyze.c 2002/02/14 16:58:38 1.14.2.1 --- analyze.c 2002/02/20 01:25:54 *************** transformStmt(ParseState *pstate, Node * *** 270,275 **** --- 270,276 ---- break; case T_SelectStmt: + case T_CreateAsStmt: if (((SelectStmt *) parseTree)->op == SETOP_NONE) result = transformSelectStmt(pstate, (SelectStmt *) parseTree); Index: src/backend/parser/gram.y =================================================================== RCS file: /cvs/cvsfiles/devo/pgsql/src/backend/parser/gram.y,v retrieving revision 1.14 diff -c -p -r1.14 gram.y *** gram.y 2002/02/04 20:59:24 1.14 --- gram.y 2002/02/20 01:25:55 *************** CreateAsStmt: CREATE OptTemp TABLE rela *** 1625,1630 **** --- 1625,1631 ---- n->istemp = $2; n->into = $4; n->intoColNames = $5; + n->type = T_CreateAsStmt; /* Same structure, different tag */ $$ = $7; } ; Index: src/backend/tcop/postgres.c =================================================================== RCS file: /cvs/cvsfiles/devo/pgsql/src/backend/tcop/postgres.c,v retrieving revision 1.15.2.1 diff -c -p -r1.15.2.1 postgres.c *** postgres.c 2002/02/19 16:09:19 1.15.2.1 --- postgres.c 2002/02/20 01:25:55 *************** pg_exec_query_string(char *query_string, *** 824,830 **** { if (DebugLvl > 1) elog(DEBUG, "ProcessQuery"); ! ProcessQuery(querytree, plan, dest); } if (Show_executor_stats) --- 824,830 ---- { if (DebugLvl > 1) elog(DEBUG, "ProcessQuery"); ! ProcessQuery(querytree, plan, dest, commandTag); } if (Show_executor_stats) *************** CreateCommandTag(Node *parsetree) *** 2155,2160 **** --- 2155,2161 ---- break; case T_CreateStmt: + case T_CreateAsStmt: tag = "CREATE"; break; Index: src/backend/tcop/pquery.c =================================================================== RCS file: /cvs/cvsfiles/devo/pgsql/src/backend/tcop/pquery.c,v retrieving revision 1.12.2.1 diff -c -p -r1.12.2.1 pquery.c *** pquery.c 2002/02/19 16:09:19 1.12.2.1 --- pquery.c 2002/02/20 01:25:55 *************** PreparePortal(char *portalName) *** 167,176 **** void ProcessQuery(Query *parsetree, Plan *plan, ! CommandDest dest) { int operation = parsetree->commandType; - char *tag; bool isRetrieveIntoPortal; bool isRetrieveIntoRelation; char *intoName = NULL; --- 167,176 ---- void ProcessQuery(Query *parsetree, Plan *plan, ! CommandDest dest, ! char * tag) { int operation = parsetree->commandType; bool isRetrieveIntoPortal; bool isRetrieveIntoRelation; char *intoName = NULL; *************** ProcessQuery(Query *parsetree, *** 180,186 **** EState *state; TupleDesc attinfo; ! tag = CreateOperationTag(operation); /* * initialize portal/into relation status --- 180,188 ---- EState *state; TupleDesc attinfo; ! if (tag == NULL) ! tag = CreateOperationTag(operation); ! /* * initialize portal/into relation status Index: src/include/nodes/nodes.h =================================================================== RCS file: /cvs/cvsfiles/devo/pgsql/src/include/nodes/nodes.h,v retrieving revision 1.13 diff -c -p -r1.13 nodes.h *** nodes.h 2002/02/04 20:59:39 1.13 --- nodes.h 2002/02/20 01:25:55 *************** typedef enum NodeTag *** 194,199 **** --- 194,200 ---- T_DropGroupStmt, T_ReindexStmt, T_CheckPointStmt, + T_CreateAsStmt, T_A_Expr = 700, T_Attr, Index: src/include/nodes/parsenodes.h =================================================================== RCS file: /cvs/cvsfiles/devo/pgsql/src/include/nodes/parsenodes.h,v retrieving revision 1.13 diff -c -p -r1.13 parsenodes.h *** parsenodes.h 2002/02/04 20:59:39 1.13 --- parsenodes.h 2002/02/20 01:25:55 *************** typedef struct SelectStmt *** 910,915 **** --- 910,925 ---- } SelectStmt; /* ---------------------- + * Create Table ... As Statement + * + * A CREATE TABLE ... AS statement is a SelectStmt with the + * 'into' field set and the proper tag. + * ---------------------- + */ + + typedef struct SelectStmt CreateAsStmt; + + /* ---------------------- * Set Operation node for post-analysis query trees * * After parse analysis, a SELECT with set operations is represented by a Index: src/include/tcop/pquery.h =================================================================== RCS file: /cvs/cvsfiles/devo/pgsql/src/include/tcop/pquery.h,v retrieving revision 1.11 diff -c -p -r1.11 pquery.h *** pquery.h 2002/02/04 20:59:40 1.11 --- pquery.h 2002/02/20 01:25:55 *************** *** 18,24 **** #include "utils/portal.h" ! extern void ProcessQuery(Query *parsetree, Plan *plan, CommandDest dest); extern EState *CreateExecutorState(void); --- 18,25 ---- #include "utils/portal.h" ! extern void ProcessQuery(Query *parsetree, Plan *plan, CommandDest dest, ! char *tag); extern EState *CreateExecutorState(void);