From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: plpgsql fails to reinitialize record variables at block re-entry
Date: Sat, 09 Dec 2017 12:19:49 -0500
Message-ID: <771.1512839989@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFj8pRBjBAdw-RdEA4wWinw-Ypbh=nT-h+DY2BM+BKcbwTRaWg@mail.gmail.com>
References: <22994.1512800671@sss.pgh.pa.us>
<CAFj8pRBjBAdw-RdEA4wWinw-Ypbh=nT-h+DY2BM+BKcbwTRaWg@mail.gmail.com>
Pavel Stehule <pavel.stehule@gmail.com> writes:
> 2017-12-09 7:24 GMT+01:00 Tom Lane <tgl@sss.pgh.pa.us>:
>> Surely that ought to have failed at the i=2 iteration. There is
>> code in plpgsql's exec_stmt_block() that tries to reinitialize
>> PLPGSQL_DTYPE_REC variables, but it's never reached (as a quick
>> look at coverage.postgresql.org will confirm), because what it
>> scans is only the variables attached to the block by
>> plpgsql_add_initdatums() --- and that function thinks it should
>> only pay attention to PLPGSQL_DTYPE_VAR variables.
> +1
Pushed. Some excavation in our git history says this bug has been
there since the initial commit of plpgsql, making it a little over
19 years old. Might be a new record for the age of a PG bug.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pavel.stehule@gmail.com
Subject: Re: plpgsql fails to reinitialize record variables at block re-entry
In-Reply-To: <771.1512839989@sss.pgh.pa.us>
References: <22994.1512800671@sss.pgh.pa.us> <CAFj8pRBjBAdw-RdEA4wWinw-Ypbh=nT-h+DY2BM+BKcbwTRaWg@mail.gmail.com> <771.1512839989@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