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;

 last_name | first_name | count
-----------+------------+-------
 GUINESS   | PENELOPE   |     1
 GUINESS   |            |     1
           |            |     1

Expected: 

 select "last_name", "first_name", count("actor_id")
        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)


The only difference between the two queries is the "first_name" filter added to the second.

Thank you!
Chris
Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: WAL segments removed from primary despite the fact that logical replication slot needs it.
Следующее
От: sebastian.patino-lang@posteo.net
Дата:
Сообщение: Re: BUG #17691: Unexpected behaviour using ts_headline()