From 5251e7b3d07da28b48ec5c7930c8b57b554fd27a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 5 Nov 2001 05:00:14 +0000 Subject: CREATE TABLE foo (x,y,z) AS SELECT ... can't apply target column names to the target list in gram.y; it must wait till after expansion of the target list in analyze.c. Per bug report 4-Nov: lx=# CREATE TABLE abc (a char, b char, c char); CREATE lx=# CREATE TABLE xyz (x, y, z) AS SELECT * FROM abc; ERROR: CREATE TABLE/AS SELECT has mismatched column count --- src/backend/nodes/copyfuncs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/backend/nodes/copyfuncs.c') diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 620054380a4..6977a6081de 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.159 2001/10/25 05:49:30 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.160 2001/11/05 05:00:14 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1835,6 +1835,7 @@ _copySelectStmt(SelectStmt *from) if (from->into) newnode->into = pstrdup(from->into); newnode->istemp = from->istemp; + Node_Copy(from, newnode, intoColNames); Node_Copy(from, newnode, targetList); Node_Copy(from, newnode, fromClause); Node_Copy(from, newnode, whereClause); -- cgit v1.2.3