cockroachdb / cockroachdb/cockroach
sql: missing validation for SRFs with the same name
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
We seem to be missing some validation that multiple SRFs used as data sources in a query do not have the same name. Here's an example in CRDB:
```
root@localhost:26257/defaultdb> select * from generate_series(1, 1), generate_series(2, 2);
generate_series | generate_series
------------------+------------------
1 | 2
(1 row)
```
vs Postgres:
```
postgres=# select * from generate_series(1, 1), generate_series(2, 2);
ERROR: table name "generate_series" specified more than once
```
Interestingly, we do perform the validation when the SRFs are given the same explicit alias:
```
root@localhost:26257/defaultdb> select * from generate_series(1, 1) g(t), generate_series(2, 2) g(t);
ERROR: source name "g" specified more than once (missing AS clause)
SQLSTATE: 42712
```
Jira issue: CRDB-49143
Contributor guide
Assessment
This issue has not been assessed yet.