From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: zpetukhov@gmail.com
Subject: BUG #17057: Unexpected error: ERROR: unsupported target type: 0
Date: Thu, 10 Jun 2021 21:46:10 +0000
Message-ID: <17057-5ddf70c25e23468f@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17057
Logged by: Zlatoslav Petukhov
Email address: zpetukhov@gmail.com
PostgreSQL version: 13.1
Operating system: different linux versions
Description:
Hi to all,
I faced with an odd error while developing a stored procedure with
transaction control inside.
We use postgres v 13.1 on AWS RDS.
I maximally simplified the code to demonstrate the error.
The simplified code is here:
https://dbfiddle.uk/?rdbms=postgres_13&fiddle=8cff4a98ac7fcefaaf9f38db68240cc1
It fails when executed on postgres versions 11 and 13.1.
No error on v12 (at least in the dbfiddle.uk instance). I didn't tested on
13.2 - I don't have such instance.
The code is copied below (not sure about dbfiddle.uk rules, how long the
fiddle will be available, etc).
So.... The stored procedure:
-----------------------------
CREATE OR REPLACE PROCEDURE public.testp(
INOUT p1 integer
)
LANGUAGE 'plpgsql'
AS $$
begin
commit;
if (p1 <= 10) then
p1 := 7;
else
p1 := 77;
end if;
end;
$$;
-----------------------------
And the calling code:
-----------------------------
--select version();
do
$$
declare
p1 integer;
begin
p1 := -1;
call testp(p1);
RAISE NOTICE '! %', p1;
p1 := -2;
call testp(p1);
RAISE NOTICE '! %', p1;
p1 := 11;
call testp(p1);
RAISE NOTICE '! %', p1;
end;
$$
-----------------------------
Additional info:
the code raises the error only when executed for the first time in a
session.
the second (and subsequent) execution gives no errors.
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: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, zpetukhov@gmail.com
Subject: Re: BUG #17057: Unexpected error: ERROR: unsupported target type: 0
In-Reply-To: <17057-5ddf70c25e23468f@postgresql.org>
* 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