pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix planner error (or assert trap) with nested set operations. 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix planner error (or assert trap) with nested set operations. @ 2017-04-07 16:18 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2017-04-07 16:18 UTC (permalink / raw) To: pgsql-committers Fix planner error (or assert trap) with nested set operations. As reported by Sean Johnston in bug #14614, since 9.6 the planner can fail due to trying to look up the referent of a Var with varno 0. This happens because we generate such Vars in generate_append_tlist, for lack of any better way to describe the output of a SetOp node. In typical situations nothing really cares about that, but given nested set-operation queries we will call estimate_num_groups on the output of the subquery, and that wants to know what a Var actually refers to. That logic used to look at subquery->targetList, but in commit 3fc6e2d7f I'd switched it to look at subroot->processed_tlist, ie the actual output of the subquery plan not the parser's idea of the result. It seemed like a good idea at the time :-(. As a band-aid fix, change it back. Really we ought to have an honest way of naming the outputs of SetOp steps, which suggests that it'd be a good idea for the parser to emit an RTE corresponding to each one. But that's a task for another day, and it certainly wouldn't yield a back-patchable fix. Report: https://postgr.es/m/20170407115808.25934.51866@wrigleys.postgresql.org Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/89deca582a345b9c423bed8ebcf24b6ee81a9953 Modified Files -------------- src/backend/optimizer/prep/prepunion.c | 12 +++++++++++- src/test/regress/expected/union.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/union.sql | 6 ++++++ 3 files changed, 42 insertions(+), 1 deletion(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix planner error (or assert trap) with nested set operations. @ 2017-04-07 16:18 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2017-04-07 16:18 UTC (permalink / raw) To: pgsql-committers Fix planner error (or assert trap) with nested set operations. As reported by Sean Johnston in bug #14614, since 9.6 the planner can fail due to trying to look up the referent of a Var with varno 0. This happens because we generate such Vars in generate_append_tlist, for lack of any better way to describe the output of a SetOp node. In typical situations nothing really cares about that, but given nested set-operation queries we will call estimate_num_groups on the output of the subquery, and that wants to know what a Var actually refers to. That logic used to look at subquery->targetList, but in commit 3fc6e2d7f I'd switched it to look at subroot->processed_tlist, ie the actual output of the subquery plan not the parser's idea of the result. It seemed like a good idea at the time :-(. As a band-aid fix, change it back. Really we ought to have an honest way of naming the outputs of SetOp steps, which suggests that it'd be a good idea for the parser to emit an RTE corresponding to each one. But that's a task for another day, and it certainly wouldn't yield a back-patchable fix. Report: https://postgr.es/m/20170407115808.25934.51866@wrigleys.postgresql.org Branch ------ REL9_6_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/c0a493e17cc3b99b6d625d5818dc9b504a54d360 Modified Files -------------- src/backend/optimizer/prep/prepunion.c | 12 +++++++++++- src/test/regress/expected/union.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/union.sql | 6 ++++++ 3 files changed, 42 insertions(+), 1 deletion(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2017-04-07 16:18 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2017-04-07 16:18 pgsql: Fix planner error (or assert trap) with nested set operations. Tom Lane <tgl@sss.pgh.pa.us> 2017-04-07 16:18 pgsql: Fix planner error (or assert trap) with nested set operations. 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