BUG #18463: Possible bug in stored procedures with polymorphic OUT parameters

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: drewk(at)cockroachlabs(dot)com
Subject: BUG #18463: Possible bug in stored procedures with polymorphic OUT parameters
Date: 2024-05-14 06:45:29
Message-ID: 18463-f8cd77e12564d8a2@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: 18463
Logged by: Drew Kimball
Email address: drewk(at)cockroachlabs(dot)com
PostgreSQL version: 16.3
Operating system: macOS
Description:

Hello,

I believe there may be a bug related to stored procedures with
polymorphic-typed OUT parameters:

CREATE PROCEDURE p(INOUT x ANYELEMENT) LANGUAGE SQL AS $$ SELECT x; $$;
CALL p(1);

The above example results in an error message "cannot display a value of
type anyelement", but I would expect it to succeed and output "1". This also
reproduces with the following stored procedures:

CREATE PROCEDURE p(INOUT x ANYELEMENT) LANGUAGE SQL AS $$ SELECT 1; $$;
CREATE PROCEDURE p(x ANYELEMENT, OUT y ANYELEMENT) LANGUAGE SQL AS $$ SELECT
x; $$;
CREATE PROCEDURE p(x ANYARRAY, OUT y ANYELEMENT) LANGUAGE SQL AS $$ SELECT
x[1]; $$;

Interestingly, this doesn't seem to reproduce when the OUT param has type
ANYARRAY. The following example succeeds:

CREATE PROCEDURE p(INOUT x ANYARRAY) LANGUAGE SQL AS $$ SELECT x; $$;
CALL p(ARRAY[1, 2, 3]);

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ugur Yilmaz 2024-05-14 07:40:41 Ynt: Postgresql 16.3 installation error (setup file) on Windows 11
Previous Message Thomas Munro 2024-05-14 06:38:20 Re: [EXTERNAL] Re: Windows Application Issues | PostgreSQL | REF # 48475607