]> granicus.if.org Git - postgresql/commit
Be more paranoid in ruleutils.c's get_variable().
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 1 Jul 2016 15:40:22 +0000 (11:40 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 1 Jul 2016 15:40:22 +0000 (11:40 -0400)
commitb0f20c2ea5f429a4a7bea01e2f721364bf0bd043
tree6397a45268abda2dfdd66d90820bca674c5660f9
parent17bfef80ee24f2204e66eb28277fddecdad64318
Be more paranoid in ruleutils.c's get_variable().

We were merely Assert'ing that the Var matched the RTE it's supposedly
from.  But if the user passes incorrect information to pg_get_expr(),
the RTE might in fact not match; this led either to Assert failures
or core dumps, as reported by Chris Hanks in bug #14220.  To fix, just
convert the Asserts to test-and-elog.  Adjust an existing test-and-elog
elsewhere in the same function to be consistent in wording.

(If we really felt these were user-facing errors, we might promote them to
ereport's; but I can't convince myself that they're worth translating.)

Back-patch to 9.3; the problematic code doesn't exist before that, and
a quick check says that 9.2 doesn't crash on such cases.

Michael Paquier and Thomas Munro

Report: <20160629224349.1407.32667@wrigleys.postgresql.org>
src/backend/utils/adt/ruleutils.c