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

Commit3a0d95d

Browse files
committed
Yawn ... still another place not quite ready for zero-column tables.
1 parentfda15b3 commit3a0d95d

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

‎src/backend/optimizer/prep/prepunion.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.109 2004/04/07 18:17:25 tgl Exp $
17+
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.110 2004/05/11 22:43:55 tgl Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -264,8 +264,11 @@ generate_union_plan(SetOperationStmt *op, Query *parse,
264264
List*sortList;
265265

266266
sortList=addAllTargetsToSortList(NULL,NIL,tlist, false);
267-
plan= (Plan*)make_sort_from_sortclauses(parse,sortList,plan);
268-
plan= (Plan*)make_unique(plan,sortList);
267+
if (sortList)
268+
{
269+
plan= (Plan*)make_sort_from_sortclauses(parse,sortList,plan);
270+
plan= (Plan*)make_unique(plan,sortList);
271+
}
269272
*sortClauses=sortList;
270273
}
271274
else
@@ -324,6 +327,13 @@ generate_nonunion_plan(SetOperationStmt *op, Query *parse,
324327
* correct output.
325328
*/
326329
sortList=addAllTargetsToSortList(NULL,NIL,tlist, false);
330+
331+
if (sortList==NIL)/* nothing to sort on? */
332+
{
333+
*sortClauses=NIL;
334+
returnplan;
335+
}
336+
327337
plan= (Plan*)make_sort_from_sortclauses(parse,sortList,plan);
328338
switch (op->op)
329339
{
@@ -519,9 +529,9 @@ generate_append_tlist(List *colTypes, bool flag,
519529
* First extract typmods to use.
520530
*
521531
* If the inputs all agree on type and typmod of a particular column, use
522-
* that typmod; else use -1.
532+
* that typmod; else use -1. (+1 here in case of zero columns.)
523533
*/
524-
colTypmods= (int32*)palloc(length(colTypes)*sizeof(int32));
534+
colTypmods= (int32*)palloc(length(colTypes)*sizeof(int32)+1);
525535

526536
foreach(planl,input_plans)
527537
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp