pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Avoid crash in eval_const_expressions if a Param's type changes. 2+ messages / 1 participants [nested] [flat]
* pgsql: Avoid crash in eval_const_expressions if a Param's type changes. @ 2018-07-26 22:18 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2018-07-26 22:18 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid crash in eval_const_expressions if a Param's type changes. Since commit 6719b238e it's been possible for the values of plpgsql record field variables to be exposed to the planner as Params. (Before that, plpgsql never supplied values for such variables during planning, so that the problematic code wasn't reached.) Other places that touch potentially-type-mutable Params either cope gracefully or do runtime-test-and-ereport checks that the type is what they expect. But eval_const_expressions() just had an Assert, meaning that it either failed the assertion or risked crashes due to using an incompatible value. In this case, rather than throwing an ereport immediately, we can just not perform a const-substitution in case of a mismatch. This seems important for the same reason that the Param fetch was speculative: we might not actually reach this part of the expression at runtime. Test case will follow in a separate commit. Patch by me, pursuant to bug report from Andrew Gierth. Back-patch to v11 where the previous commit appeared. Discussion: https://postgr.es/m/87wotkfju1.fsf@news-spur.riddles.org.uk Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9207a64e1496d9be8b7f33f2ac30052c130c61c3 Modified Files -------------- src/backend/optimizer/util/clauses.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Avoid crash in eval_const_expressions if a Param's type changes. @ 2018-07-26 22:18 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2018-07-26 22:18 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid crash in eval_const_expressions if a Param's type changes. Since commit 6719b238e it's been possible for the values of plpgsql record field variables to be exposed to the planner as Params. (Before that, plpgsql never supplied values for such variables during planning, so that the problematic code wasn't reached.) Other places that touch potentially-type-mutable Params either cope gracefully or do runtime-test-and-ereport checks that the type is what they expect. But eval_const_expressions() just had an Assert, meaning that it either failed the assertion or risked crashes due to using an incompatible value. In this case, rather than throwing an ereport immediately, we can just not perform a const-substitution in case of a mismatch. This seems important for the same reason that the Param fetch was speculative: we might not actually reach this part of the expression at runtime. Test case will follow in a separate commit. Patch by me, pursuant to bug report from Andrew Gierth. Back-patch to v11 where the previous commit appeared. Discussion: https://postgr.es/m/87wotkfju1.fsf@news-spur.riddles.org.uk Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/662d12aea1d697adc4896ff7e5d5cf398c0cd267 Modified Files -------------- src/backend/optimizer/util/clauses.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-07-26 22:18 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-07-26 22:18 pgsql: Avoid crash in eval_const_expressions if a Param's type changes. Tom Lane <tgl@sss.pgh.pa.us> 2018-07-26 22:18 pgsql: Avoid crash in eval_const_expressions if a Param's type changes. 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