cockroachdb / cockroachdb/cockroach

sql: allow RECORD-typed OUT params for routines

Open
#123,448 0 comments 0 reactions 0 assignees View on GitHub
A-sql-routine C-enhancement docs-done docs-known-limitation T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Postgres doesn't allow a SQL routine input argument to be defined with type `RECORD`. However, it does allow a pure OUT parameter to have that type:
```
postgres=# create function f(out x record) language sql as $$ select row(1); $$;
CREATE FUNCTION
postgres=# select f();
f
-----
(1)
(1 row)
```
Currently, CRDB correctly disallows input `RECORD` parameters, but incorrectly also disallows output `RECORD` parameters:
```
root@localhost:26257/defaultdb> create function f(out x record) language sql as $$ select row(1); $$;
ERROR: SQL functions cannot have arguments of type record
SQLSTATE: 42P13
```

Jira issue: CRDB-38355

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.