BUG #18463: Possible bug in stored procedures with polymorphic OUT parameters
PG Bug reporting form <noreply@postgresql.org>
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: drewk@cockroachlabs.com
Date: 2024-05-14T06:45:29Z
Lists: pgsql-bugs
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix failure with SQL-procedure polymorphic output arguments in v12.
- d88dcdf0fa5b 14.13 landed
- bb331af4aeb7 16.4 landed
- 9de0ff91a501 13.16 landed
- 751598263690 17.0 landed
- 5fe43d41db59 15.8 landed
- 4208f44c9469 12.20 landed
-
Fix handling of polymorphic output arguments for procedures.
- f535f350c1f9 17.0 landed
- e85f641b2b52 13.16 landed
- c40e78d239a8 15.8 landed
- 8e0e99972ad9 16.4 landed
- 70ffb27b2349 12.20 landed
- 525bd1620e9b 14.13 landed
The following bug has been logged on the website: Bug reference: 18463 Logged by: Drew Kimball Email address: drewk@cockroachlabs.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]);