pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Clear more substructure of a dead relation during join removal. 5+ messages / 1 participants [nested] [flat]
* pgsql: Clear more substructure of a dead relation during join removal. @ 2026-10-14 19:37 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2026-10-14 19:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clear more substructure of a dead relation during join removal. The tablesample and securityQuals subtrees of a RangeTblEntry can include Vars, which will cause trouble if they point at a removed rel and are visited during later processing. Hence, clear those fields during join removal, as we already do for the subquery field. remove_useless_outer_joins got this right for securityQuals but not tablesample, while remove_self_join_rel missed doing it for securityQuals. (It escapes trouble for tablesample only because we made a policy decision to never touch sampled relations for SJE.) Oversight in 2ebf25e7d. Back-patch to v16, like that commit (but the SJE issue only goes as far back as v18). Author: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAGRkXqSOAT1yop44B8jwacL_91rxK=QuoU8Of3NLMb9NgAO2NA@mail.gmail.com Backpatch-through: 16 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/91b1872ff2de16cd353598edbc650a185e649226 Modified Files -------------- src/backend/optimizer/plan/analyzejoins.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Clear more substructure of a dead relation during join removal. @ 2026-10-14 19:37 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2026-10-14 19:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clear more substructure of a dead relation during join removal. The tablesample and securityQuals subtrees of a RangeTblEntry can include Vars, which will cause trouble if they point at a removed rel and are visited during later processing. Hence, clear those fields during join removal, as we already do for the subquery field. remove_useless_outer_joins got this right for securityQuals but not tablesample, while remove_self_join_rel missed doing it for securityQuals. (It escapes trouble for tablesample only because we made a policy decision to never touch sampled relations for SJE.) Oversight in 2ebf25e7d. Back-patch to v16, like that commit (but the SJE issue only goes as far back as v18). Author: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAGRkXqSOAT1yop44B8jwacL_91rxK=QuoU8Of3NLMb9NgAO2NA@mail.gmail.com Backpatch-through: 16 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0c45929db4825843f5ac2c0a54a65b90a9a541fd Modified Files -------------- src/backend/optimizer/plan/analyzejoins.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Clear more substructure of a dead relation during join removal. @ 2026-10-14 19:37 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2026-10-14 19:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clear more substructure of a dead relation during join removal. The tablesample and securityQuals subtrees of a RangeTblEntry can include Vars, which will cause trouble if they point at a removed rel and are visited during later processing. Hence, clear those fields during join removal, as we already do for the subquery field. remove_useless_outer_joins got this right for securityQuals but not tablesample, while remove_self_join_rel missed doing it for securityQuals. (It escapes trouble for tablesample only because we made a policy decision to never touch sampled relations for SJE.) Oversight in 2ebf25e7d. Back-patch to v16, like that commit (but the SJE issue only goes as far back as v18). Author: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAGRkXqSOAT1yop44B8jwacL_91rxK=QuoU8Of3NLMb9NgAO2NA@mail.gmail.com Backpatch-through: 16 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/18aca7257eb0330d7ea6391a085ff45d57496ce2 Modified Files -------------- src/backend/optimizer/plan/analyzejoins.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Clear more substructure of a dead relation during join removal. @ 2026-10-14 19:37 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2026-10-14 19:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clear more substructure of a dead relation during join removal. The tablesample and securityQuals subtrees of a RangeTblEntry can include Vars, which will cause trouble if they point at a removed rel and are visited during later processing. Hence, clear those fields during join removal, as we already do for the subquery field. remove_useless_outer_joins got this right for securityQuals but not tablesample, while remove_self_join_rel missed doing it for securityQuals. (It escapes trouble for tablesample only because we made a policy decision to never touch sampled relations for SJE.) Oversight in 2ebf25e7d. Back-patch to v16, like that commit (but the SJE issue only goes as far back as v18). Author: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAGRkXqSOAT1yop44B8jwacL_91rxK=QuoU8Of3NLMb9NgAO2NA@mail.gmail.com Backpatch-through: 16 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/12f10c25ce3febf9b94748d28c8332f827779980 Modified Files -------------- src/backend/optimizer/plan/analyzejoins.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Clear more substructure of a dead relation during join removal. @ 2026-10-14 19:37 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2026-10-14 19:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clear more substructure of a dead relation during join removal. The tablesample and securityQuals subtrees of a RangeTblEntry can include Vars, which will cause trouble if they point at a removed rel and are visited during later processing. Hence, clear those fields during join removal, as we already do for the subquery field. remove_useless_outer_joins got this right for securityQuals but not tablesample, while remove_self_join_rel missed doing it for securityQuals. (It escapes trouble for tablesample only because we made a policy decision to never touch sampled relations for SJE.) Oversight in 2ebf25e7d. Back-patch to v16, like that commit (but the SJE issue only goes as far back as v18). Author: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAGRkXqSOAT1yop44B8jwacL_91rxK=QuoU8Of3NLMb9NgAO2NA@mail.gmail.com Backpatch-through: 16 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d15ab66f500cc70b7dcc9ffdf3843b7013163d37 Modified Files -------------- src/backend/optimizer/plan/analyzejoins.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-10-14 19:37 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-10-14 19:37 pgsql: Clear more substructure of a dead relation during join removal. Tom Lane <tgl@sss.pgh.pa.us> 2026-10-14 19:37 pgsql: Clear more substructure of a dead relation during join removal. Tom Lane <tgl@sss.pgh.pa.us> 2026-10-14 19:37 pgsql: Clear more substructure of a dead relation during join removal. Tom Lane <tgl@sss.pgh.pa.us> 2026-10-14 19:37 pgsql: Clear more substructure of a dead relation during join removal. Tom Lane <tgl@sss.pgh.pa.us> 2026-10-14 19:37 pgsql: Clear more substructure of a dead relation during join removal. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox