Re: Stable sort?

Поиск
Список
Период
Сортировка
От Ron Mayer
Тема Re: Stable sort?
Дата
Msg-id 45512845.9080708@cheapcomplexdevices.com
обсуждение исходный текст
Ответ на Stable sort?  ("redhog" <redhog@redhog.org>)
Список pgsql-general
redhog wrote:
> Is sorting in PostgreSQL stable over subqueries, that is, is
>
> select * from (select * from A order by x) as B order by y;
>
> equivalent with
>
> select * from A order by y, x;

Seems as easy to try as to guess.

If I did this query right, it seems not.

select * from (select random()>0.5 as a, random()>0.5 as b from generate_series(1,10) order by a) as x order by b;
 a | b
---+---
 f | t
 f | f
 f | f
 f | f
 f | t
 f | f
 t | t
 t | t
 t | t
 t | f
(10 rows)

OTOH, HEY, why isn't that result ordered by 'b' instead of by 'a' (or am I misreading my query or the results)?

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

Предыдущее
От: Wei Weng
Дата:
Сообщение: Question on inserting and querying at the same time.
Следующее
От: Ron Peterson
Дата:
Сообщение: A couple more PostgreSQL C questions