pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #17057: Unexpected error: ERROR:  unsupported target type: 0
3+ messages / 3 participants
[nested] [flat]

* BUG #17057: Unexpected error: ERROR:  unsupported target type: 0
@ 2021-06-10 21:46 PG Bug reporting form <noreply@postgresql.org>
  2021-06-10 22:19 ` Re: BUG #17057: Unexpected error: ERROR: unsupported target type: 0 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Bug reporting form @ 2021-06-10 21:46 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: zpetukhov@gmail.com

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.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #17057: Unexpected error: ERROR: unsupported target type: 0
  2021-06-10 21:46 BUG #17057: Unexpected error: ERROR:  unsupported target type: 0 PG Bug reporting form <noreply@postgresql.org>
@ 2021-06-10 22:19 ` Tom Lane <tgl@sss.pgh.pa.us>
  2021-06-11 21:09   ` Re: BUG #17057: Unexpected error: ERROR: unsupported target type: 0 Zlatoslav Petukhov <zpetukhov@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2021-06-10 22:19 UTC (permalink / raw)
  To: zpetukhov@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> I faced with an odd error while developing a stored procedure with
> transaction control inside.

Hi, this works fine for me on all branches back to v11.
I get

NOTICE:  ! 7
NOTICE:  ! 7
NOTICE:  ! 77

which looks like the correct behavior.  I suspect you're hitting
the bug fixed in commit 0ea25ed10, so you need to update to 13.2
or later.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #17057: Unexpected error: ERROR: unsupported target type: 0
  2021-06-10 21:46 BUG #17057: Unexpected error: ERROR:  unsupported target type: 0 PG Bug reporting form <noreply@postgresql.org>
  2021-06-10 22:19 ` Re: BUG #17057: Unexpected error: ERROR: unsupported target type: 0 Tom Lane <tgl@sss.pgh.pa.us>
@ 2021-06-11 21:09   ` Zlatoslav Petukhov <zpetukhov@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Zlatoslav Petukhov @ 2021-06-11 21:09 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org

> I suspect you're hitting the bug fixed in commit 0ea25ed10,
> so you need to update to 13.2

Thank you for the answer.
Upgrading to 13.2 helped.
(this info is for other devs which will face the issue.
Google does not give much results on "ERROR: unsupported target type: 0"
so, probably, searching people will "land" here).

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2021-06-11 21:09 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 21:46 BUG #17057: Unexpected error: ERROR:  unsupported target type: 0 PG Bug reporting form <noreply@postgresql.org>
2021-06-10 22:19 ` Re: BUG #17057: Unexpected error: ERROR: unsupported target type: 0 Tom Lane <tgl@sss.pgh.pa.us>
2021-06-11 21:09   ` Re: BUG #17057: Unexpected error: ERROR: unsupported target type: 0 Zlatoslav Petukhov <zpetukhov@gmail.com>

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