From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: bernddorn@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17227: segmentation fault with jsonb_to_recordset
Date: Thu, 14 Oct 2021 11:29:33 -0400
Message-ID: <794910.1634225373@sss.pgh.pa.us> (raw)
In-Reply-To: <709405.1634165890@sss.pgh.pa.us>
References: <202110131359.a6m35hpudkg7@alvherre.pgsql>
<649678.1634135335@sss.pgh.pa.us>
<675396.1634157283@sss.pgh.pa.us>
<676464.1634158492@sss.pgh.pa.us>
<709405.1634165890@sss.pgh.pa.us>
I wrote:
> The whole thing makes me itch a little bit, because this logic is
> assuming that eval_const_expressions is idempotent, something
> we can't test very well and (AFAIR) are not assuming anywhere else.
> If somebody made some sub-case not idempotent, we'd not notice until
> that case got used in a lateral function RTE.
It occurred to me that we could test for problems with double
execution of eval_const_expressions by making planner.c deliberately
call it twice in all cases. A quick hack later, I can say that
"make check-world" doesn't reveal any such problem. While that's
hardly conclusive, it's pretty strong evidence, since the code
coverage report shows eval_const_expressions as well covered (and
the lines not reached are mostly returning simplified Const nodes,
so hardly likely to be a problem here).
We could make a persistent check for that by enclosing the extra
calls in something like "#ifdef DOUBLE_EVAL_CONST_EXPRESSIONS"
and setting up some buildfarm member to define that. But since
(AFAIR) we've never actually had such a bug, it seems unlikely
to be worth the trouble.
I'll go ahead with the patch as presented.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, alvherre@alvh.no-ip.org, bernddorn@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17227: segmentation fault with jsonb_to_recordset
In-Reply-To: <794910.1634225373@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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