Sort Order inconsistent when using Grouping Sets Rollup
От | Chris Rohlfs |
---|---|
Тема | Sort Order inconsistent when using Grouping Sets Rollup |
Дата | |
Msg-id | CAL48EtKDHCKnOkLdSgOmgBZBcahU2zpBqyzeET_ZM74uNZBFHg@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Sort Order inconsistent when using Grouping Sets Rollup
|
Список | pgsql-bugs |
The attached file will create a table and run 2 queries, the first of which is not honoring the requested sort order. I expect the Nulls first.
I have found this problem in Postgres 12.7 (pop os) and 14.6 (mac Postgres.app)
Incorrect:
select "last_name", "first_name", count("actor_id")
from actor
where (( "actor_id" >= 1 ) and ( "last_name" = 'GUINESS' ) and ( "first_name" = 'PENELOPE' ))
group by rollup( 1, 2 )
order by 1 asc nulls first, 2 asc nulls first;
from actor
where (( "actor_id" >= 1 ) and ( "last_name" = 'GUINESS' ) and ( "first_name" = 'PENELOPE' ))
group by rollup( 1, 2 )
order by 1 asc nulls first, 2 asc nulls first;
last_name | first_name | count
-----------+------------+-------
GUINESS | PENELOPE | 1
GUINESS | | 1
| | 1
-----------+------------+-------
GUINESS | PENELOPE | 1
GUINESS | | 1
| | 1
Expected:
from actor
where (( "actor_id" >= 1 ) and ( "last_name" = 'GUINESS' ))
group by rollup( 1, 2 )
order by 1 asc nulls first, 2 asc nulls first;
last_name | first_name | count
-----------+------------+-------
| | 1
GUINESS | | 1
GUINESS | PENELOPE | 1
(3 rows)
-----------+------------+-------
| | 1
GUINESS | | 1
GUINESS | PENELOPE | 1
(3 rows)
The only difference between the two queries is the "first_name" filter added to the second.
Thank you!
Chris
Вложения
В списке pgsql-bugs по дате отправления: