cockroachdb / cockroachdb/cockroach
sql: CRDB allows procedure with anyelement OUT parameter
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
This issue tracks a difference between the behavior of Postgres and CRDB for stored procedures. In postgres, attempting to call a procedure with an ANYELEMENT OUT-parameter leads to an error:
```
postgres=# CREATE PROCEDURE p(x ANYELEMENT, OUT y ANYELEMENT) LANGUAGE SQL AS $$ SELECT x; $$;
CREATE PROCEDURE
postgres=# CALL p(1, NULL);
ERROR: cannot display a value of type anyelement
```
Note that calling a function with the same parameters succeeds:
```
postgres=# CREATE FUNCTION f(x ANYELEMENT, OUT y ANYELEMENT) LANGUAGE SQL AS $$ SELECT x; $$;
CREATE FUNCTION
postgres=# SELECT f(1), f(True), f(ARRAY[1, 2]);
f | f | f
---+---+-------
1 | t | {1,2}
(1 row)
```
It seems likely to be a bug or oversight on the part of Postgres, so CRDB will allow both cases.
Jira issue: CRDB-38360
Contributor guide
Assessment
This issue has not been assessed yet.