cockroachdb / cockroachdb/cockroach

sql: CRDB allows procedure with anyelement OUT parameter

Open
#123,454 0 comments 0 reactions 0 assignees View on GitHub
A-sql-pgcompat C-cleanup T-sql-queries
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.