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

Commit51227f8

Browse files
committed
Use a cleaner substitute for the inability to apply length() to the tail
of a list. Per private discussion with Neil.
1 parent0d5364f commit51227f8

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
*
1818
* IDENTIFICATION
19-
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.18 2004/05/2604:41:26 neilc Exp $
19+
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.19 2004/05/2618:35:41 tgl Exp $
2020
*
2121
*-------------------------------------------------------------------------
2222
*/
@@ -897,12 +897,15 @@ simplify_jointree(Query *parse, Node *jtnode)
897897
{
898898
FromExpr*f= (FromExpr*)jtnode;
899899
List*newlist=NIL;
900+
intchildren_remaining;
900901
ListCell*l;
901902

903+
children_remaining=list_length(f->fromlist);
902904
foreach(l,f->fromlist)
903905
{
904906
Node*child= (Node*)lfirst(l);
905907

908+
children_remaining--;
906909
/* Recursively simplify this child... */
907910
child=simplify_jointree(parse,child);
908911
/* Now, is it a FromExpr? */
@@ -917,16 +920,7 @@ simplify_jointree(Query *parse, Node *jtnode)
917920
*/
918921
FromExpr*subf= (FromExpr*)child;
919922
intchildlen=length(subf->fromlist);
920-
intmyothers;
921-
ListCell*l2;
922-
923-
/*
924-
* XXX: This is a quick hack, not sure of the proper
925-
* fix.
926-
*/
927-
myothers=length(newlist);
928-
for_each_cell(l2,lnext(l))
929-
myothers++;
923+
intmyothers=length(newlist)+children_remaining;
930924

931925
if (childlen <=1||
932926
(childlen+myothers) <=from_collapse_limit)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp