cockroachdb / cockroachdb/cockroach

sql: UDF returning SETOF VOID should produce zero rows

Open
#103,119 0 comments 0 reactions 0 assignees View on GitHub
A-sql-routine C-bug T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

In Postgres:

```
marcus=# create function f() returns setof void language sql as 'select null';
CREATE FUNCTION

marcus=# select f();
f
---
(0 rows)
```

In CRDB:

```
defaultdb> create function f() returns setof void language sql as 'select null';
CREATE FUNCTION

defaultdb> select f();
f
--------
NULL
(1 row)
```

I'm actually skeptical of PG's behavior here, and I'm not convinced we want to mimic it. It seems like `SELECT ` should always return a single row, and I don't have an explanation for why it doesn't in this case.

Jira issue: CRDB-27839

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.