pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Avoid planner crash/Assert failure with joins to unflattened sub 2+ messages / 1 participants [nested] [flat]
* pgsql: Avoid planner crash/Assert failure with joins to unflattened sub @ 2012-10-03 17:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2012-10-03 17:38 UTC (permalink / raw) To: pgsql-committers Avoid planner crash/Assert failure with joins to unflattened subqueries. examine_simple_variable supposed that any RTE_SUBQUERY rel it gets pointed at must have been planned already. However, this isn't a safe assumption because we must do selectivity estimation while generating indexscan paths, and that code might look at join clauses involving a rel that the loop in set_base_rel_sizes() hasn't reached yet. The simplest fix is to play dumb in such a situation, that is give up trying to extract any stats for the Var. This could possibly be improved by making a separate pass over the RTE list to plan each unflattened subquery before we start the main planning work --- but that would be pretty invasive and it doesn't seem worth it, for now at least. (We couldn't just break set_base_rel_sizes() into two loops: the prescan would need to handle all subquery rels in the query, not only those in the current join subproblem.) This bug was introduced in commit 1cb108efb0e60d87e4adec38e7636b6e8efbeb57, although I think that subsequent changes may have exposed it more than it was originally. Per bug #7580 from Maxim Boguk. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/1f91c8ca1d2edc66c688ee719eded79ecd0e8f1b Modified Files -------------- src/backend/utils/adt/selfuncs.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Avoid planner crash/Assert failure with joins to unflattened sub @ 2012-10-03 17:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2012-10-03 17:38 UTC (permalink / raw) To: pgsql-committers Avoid planner crash/Assert failure with joins to unflattened subqueries. examine_simple_variable supposed that any RTE_SUBQUERY rel it gets pointed at must have been planned already. However, this isn't a safe assumption because we must do selectivity estimation while generating indexscan paths, and that code might look at join clauses involving a rel that the loop in set_base_rel_sizes() hasn't reached yet. The simplest fix is to play dumb in such a situation, that is give up trying to extract any stats for the Var. This could possibly be improved by making a separate pass over the RTE list to plan each unflattened subquery before we start the main planning work --- but that would be pretty invasive and it doesn't seem worth it, for now at least. (We couldn't just break set_base_rel_sizes() into two loops: the prescan would need to handle all subquery rels in the query, not only those in the current join subproblem.) This bug was introduced in commit 1cb108efb0e60d87e4adec38e7636b6e8efbeb57, although I think that subsequent changes may have exposed it more than it was originally. Per bug #7580 from Maxim Boguk. Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/49bf146b7ad0b1751fb4d15853306dabf1ce83c6 Modified Files -------------- src/backend/utils/adt/selfuncs.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2012-10-03 17:38 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2012-10-03 17:38 pgsql: Avoid planner crash/Assert failure with joins to unflattened sub Tom Lane <tgl@sss.pgh.pa.us> 2012-10-03 17:38 pgsql: Avoid planner crash/Assert failure with joins to unflattened sub 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