Pavel Stehule <pavel.steh...@gmail.com> writes: > 2017-12-09 7:24 GMT+01:00 Tom Lane <t...@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