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

Commitaaf2442

Browse files
committed
Remove query_planner's overhasty rejection of cases where
tlist and qual are NULL. It ought to handle these the same as the caseswhere tlist contains only constant expressions, ie, be willing to generatea Result-node plan. This did not use to matter, but it does now becauseunion_planner will flatten the tlist when aggregates are present. Thus,'select count(1) from table' now causes query_planner to be given a nulltlist, and to duplicate 6.4's behavior we need it to give back a Resultplan rather than refusing the query. 6.4 was arguably doing the WrongThing for this query, but I'm not going to open a semantics issue rightbefore 6.5 release ... can revisit that problem later.
1 parentacf242d commitaaf2442

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

‎src/backend/optimizer/plan/planmain.c

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.36 1999/05/25 16:09:36 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.37 1999/06/12 19:38:30 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -68,9 +68,9 @@ query_planner(Query *root,
6868
List*qual)
6969
{
7070
List*constant_qual=NIL;
71-
List*var_only_tlist=NIL;
72-
List*level_tlist=NIL;
73-
Plan*subplan=NULL;
71+
List*var_only_tlist;
72+
List*level_tlist;
73+
Plan*subplan;
7474

7575
if (PlannerQueryLevel>1)
7676
{
@@ -87,29 +87,15 @@ query_planner(Query *root,
8787
pprint(qual);
8888
#endif
8989

90-
/*
91-
* A command without a target list or qualification is an error,
92-
* except for "delete foo".
93-
*/
94-
if (tlist==NIL&&qual==NULL)
95-
{
96-
if (command_type==CMD_DELETE)
97-
{
98-
return ((Plan*)make_seqscan(NIL,
99-
NIL,
100-
root->resultRelation,
101-
(Plan*)NULL));
102-
}
103-
else
104-
return (Plan*)NULL;
105-
}
106-
10790
/*
10891
* Pull out any non-variable qualifications so these can be put in the
109-
* topmost result node. The opids for the remaining qualifications
110-
* will be changed to regprocs later.
92+
* topmost result node.
11193
*/
11294
qual=pull_constant_clauses(qual,&constant_qual);
95+
/*
96+
* The opids for the variable qualifications will be fixed later, but
97+
* someone seems to think that the constant quals need to be fixed here.
98+
*/
11399
fix_opids(constant_qual);
114100

115101
/*
@@ -143,13 +129,13 @@ query_planner(Query *root,
143129
caseCMD_UPDATE:
144130
{
145131
SeqScan*scan=make_seqscan(tlist,
146-
(List*)NULL,
132+
NIL,
147133
root->resultRelation,
148134
(Plan*)NULL);
149135

150136
if (constant_qual!=NULL)
151137
return ((Plan*)make_result(tlist,
152-
(Node*)constant_qual,
138+
(Node*)constant_qual,
153139
(Plan*)scan));
154140
else
155141
return (Plan*)scan;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp