BUG #17057: Unexpected error: ERROR: unsupported target type: 0

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: zpetukhov(at)gmail(dot)com
Subject: BUG #17057: Unexpected error: ERROR: unsupported target type: 0
Date: 2021-06-10 21:46:10
Message-ID: 17057-5ddf70c25e23468f@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17057
Logged by: Zlatoslav Petukhov
Email address: zpetukhov(at)gmail(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-06-10 22:10:29 Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default
Previous Message PG Bug reporting form 2021-06-10 20:00:01 BUG #17056: Segmentation fault on altering the type of the foreign table column with a default