cockroachdb / cockroachdb/cockroach
plpgsql: support RECORD-returning UDFs that don't have concrete type RETURN in the root block
Open
A-sql-plpgsql
A-sql-routine
C-bug
docs-done
docs-known-limitation
docs-todo
O-qa
T-sql-queries
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
We currently don't support cases when RECORD-returning UDF doesn't have a RETURN stmt in the root block that would restrict the wildcard type to a concrete one. For example:
```sql
CREATE FUNCTION f1() RETURNS RECORD AS $$
BEGIN
END;
$$ LANGUAGE PLpgSQL;
CREATE FUNCTION f2(b BOOL) RETURNS RECORD AS $$
BEGIN
IF b THEN
RETURN f1();
ELSIF true THEN
DECLARE
BEGIN
END;
END IF;
END;
$$ LANGUAGE PLpgSQL;
```
Jira issue: CRDB-38131
Contributor guide
Assessment
This issue has not been assessed yet.