1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Use context with correct lifetime in hypothetical_dense_rank_final.

The query lifetime expression context created in
hypothetical_dense_rank_final() was buggily allocated in the calling
memory context. I (Andres) broke that in bf6c614a2f.

Reported-By: Rajkumar Raghuwanshi
Author: Amit Langote
Discussion:  https://postgr.es/m/CAKcux6kmzWmur5HhA_aU6gYVFu0RLQdgJJ+aC9SLdcOvBSrpfA@mail.gmail.com
Backpatch: 11-
This commit is contained in:
Andres Freund
2018-07-04 17:36:01 -07:00
parent 3a01f68e35
commit 249126e761
3 changed files with 21 additions and 1 deletions

View File

@ -2092,3 +2092,12 @@ SELECT variance(unique1::int4), sum(unique1::int8) FROM tenk1;
(1 row)
ROLLBACK;
-- test coverage for dense_rank
SELECT dense_rank(x) WITHIN GROUP (ORDER BY x) FROM (VALUES (1),(1),(2),(2),(3),(3)) v(x) GROUP BY (x) ORDER BY 1;
dense_rank
------------
1
1
1
(3 rows)

View File

@ -925,3 +925,6 @@ EXPLAIN (COSTS OFF)
SELECT variance(unique1::int4), sum(unique1::int8) FROM tenk1;
ROLLBACK;
-- test coverage for dense_rank
SELECT dense_rank(x) WITHIN GROUP (ORDER BY x) FROM (VALUES (1),(1),(2),(2),(3),(3)) v(x) GROUP BY (x) ORDER BY 1;