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

Commitb281ea8

Browse files
committed
Whole-row references were broken for subqueries and functions, because
attr_needed/attr_widths optimization failed to allow for Vars with attnozero in this case. Per report from Tatsuo Ishii.
1 parent918b158 commitb281ea8

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

‎src/backend/optimizer/util/relnode.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.53 2003/11/2919:51:51 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.54 2003/12/08 18:19:58 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -161,7 +161,8 @@ make_base_rel(Query *root, int relid)
161161
caseRTE_SUBQUERY:
162162
caseRTE_FUNCTION:
163163
/* Subquery or function --- need only set up attr range */
164-
rel->min_attr=1;
164+
/* Note: 0 is included in range to support whole-row Vars */
165+
rel->min_attr=0;
165166
rel->max_attr=length(rte->eref->colnames);
166167
break;
167168
default:
@@ -170,18 +171,11 @@ make_base_rel(Query *root, int relid)
170171
break;
171172
}
172173

173-
if (rel->max_attr >=rel->min_attr)
174-
{
175-
rel->attr_needed= (Relids*)
176-
palloc0((rel->max_attr-rel->min_attr+1)*sizeof(Relids));
177-
rel->attr_widths= (int32*)
178-
palloc0((rel->max_attr-rel->min_attr+1)*sizeof(int32));
179-
}
180-
else
181-
{
182-
rel->attr_needed=NULL;
183-
rel->attr_widths=NULL;
184-
}
174+
Assert(rel->max_attr >=rel->min_attr);
175+
rel->attr_needed= (Relids*)
176+
palloc0((rel->max_attr-rel->min_attr+1)*sizeof(Relids));
177+
rel->attr_widths= (int32*)
178+
palloc0((rel->max_attr-rel->min_attr+1)*sizeof(int32));
185179

186180
returnrel;
187181
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp