Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit59c325b

Browse files
committed
Repair for bug #691 --- CREATE TABLE AS column aliases fail to be
applied when the select is a UNION (or other set-operation).An alternative route to a fix would be to leave analyze.c alone andchange plan_set_operations in prepunion.c to take column names fromthe topmost targetlist. But I am not sure that would work in allcases. This patch seems the minimum-risk fix.
1 parent2ed878d commit59c325b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/backend/parser/analyze.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
*$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.235 2002/05/28 22:15:42 tgl Exp $
9+
*$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.236 2002/06/13 02:04:46 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -2212,8 +2212,16 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
22122212
qry->isBinary= FALSE;
22132213
}
22142214

2215+
/*
2216+
* Any column names from CREATE TABLE AS need to be attached to both the
2217+
* top level and the leftmost subquery. We do not do this earlier
2218+
* because we do *not* want the targetnames list to be affected.
2219+
*/
22152220
if (intoColNames)
2221+
{
22162222
applyColumnNames(qry->targetList,intoColNames);
2223+
applyColumnNames(leftmostQuery->targetList,intoColNames);
2224+
}
22172225

22182226
/*
22192227
* As a first step towards supporting sort clauses that are

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp