cockroachdb / cockroachdb/cockroach
sql: window functions next to SRFs behave differently from Postgres
- Lingua principale
- Go
- Stelle
- 32.5k
- Fork
- 4.1k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Consider the following example query, minimized from a more complex one in the `tsrf.sql` pg_regress file:
```
SELECT a, lag(a) OVER(), count(*) OVER(), generate_series(1,2) FROM (select 1) as x(a);
```
CockroachDB evaluates this differently from Postgres. According to the pg_regress test case, this is because SRFs should be computed after window functions: `-- SRFs are normally computed after window functions`
CRDB
```
root@localhost:26257/defaultdb> SELECT a, lag(a) OVER(), count(*) OVER(), generate_series(1,2) FROM (select 1) as x(a);
a | lag | count | generate_series
----+------+-------+------------------
1 | NULL | 2 | 1
1 | 1 | 2 | 2
(2 rows)
```
PG
```
jordan=# SELECT a, lag(a) OVER(), count(*) OVER(), generate_series(1,2) FROM (select 1) as x(a);
a | lag | count | generate_series
---+-----+-------+-----------------
1 | | 1 | 1
1 | | 1 | 2
(2 rows)
```
Jira issue: CRDB-22398
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.