Skip to content

Commit cdcaec5

Browse files
committed
Avoid reversing user-given order of WHERE clauses while attaching clauses
to specific base or join RelOptInfo nodes during planning. This preserves the more-intuitive behavior of 7.0.* --- if you write an expensive clause (such as a sub-select) last, it should get evaluated last. Someday we ought to try to have some intelligence about the order of evaluation of WHERE clauses, but for now we should not override what the user wrote.
1 parent 722f7ef commit cdcaec5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/optimizer/plan/initsplan.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.58 2001/03/22 03:59:36 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.59 2001/04/16 19:44:10 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -444,8 +444,8 @@ distribute_qual_to_rels(Query *root, Node *clause,
444444
*/
445445
RelOptInfo *rel = get_base_rel(root, lfirsti(relids));
446446

447-
rel->baserestrictinfo = lcons(restrictinfo,
448-
rel->baserestrictinfo);
447+
rel->baserestrictinfo = lappend(rel->baserestrictinfo,
448+
restrictinfo);
449449

450450
/*
451451
* Check for a "mergejoinable" clause even though it's not a join
@@ -549,8 +549,8 @@ add_join_info_to_rels(Query *root, RestrictInfo *restrictinfo,
549549
*/
550550
joininfo = find_joininfo_node(get_base_rel(root, cur_relid),
551551
unjoined_relids);
552-
joininfo->jinfo_restrictinfo = lcons(restrictinfo,
553-
joininfo->jinfo_restrictinfo);
552+
joininfo->jinfo_restrictinfo = lappend(joininfo->jinfo_restrictinfo,
553+
restrictinfo);
554554
}
555555
}
556556

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy