Re: Bug in comparison of empty jsonb arrays to scalars

Поиск
Список
Период
Сортировка
От Nikita Glukhov
Тема Re: Bug in comparison of empty jsonb arrays to scalars
Дата
Msg-id 9a708bf8-d778-0a6e-bb8e-7ca025bf0199@postgrespro.ru
обсуждение исходный текст
Ответ на Re: Bug in comparison of empty jsonb arrays to scalars  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
On 10.11.2016 09:54, Michael Paquier wrote:

> Yes, definitely.
> =# create table json_data (a jsonb);
> CREATE TABLE
> =# INSERT INTO json_data values ('{}'::jsonb), ('[]'::jsonb),
> ('null'::jsonb), ('true'::jsonb), ('1'::jsonb), ('""'::jsonb);
> INSERT 0 6
> =# SELECT * FROM json_data ORDER BY 1 DESC;
>    a
> ------
>   {}
>   true
>   1
>   ""
>   null
>   []
> (6 rows)
> So that's object > boolean > integer > string > NULL > array.
>
> And attached is a patch.

Perhaps I did not explain it clearly enough, but only *empty top-level* 
arrays are out of the correct order.
See complete example:

=# SELECT * FROM (VALUES    ('null'::jsonb), ('0'), ('""'), ('true'), ('[]'), ('{}'),    ('[null]'), ('[0]'), ('[""]'),
('[true]'),('[[]]'), ('[{}]'),    ('{"a": null}'), ('{"a": 0}'), ('{"a": ""}'), ('{"a": true}'), 
 
('{"a": []}'), ('{"a": {}}')
) valsORDER BY 1;   column1
------------- [] null "" 0 true [null] [""] [0] [true] [[]] [{}] {} {"a": null} {"a": ""} {"a": 0} {"a": true} {"a":
[]}{"a": {}}
 
(18 rows)


-- 
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



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

Предыдущее
От: Stefan Scheid
Дата:
Сообщение: Re: Fwd: Re: [CORE] temporal tables (SQL2011)
Следующее
От: Peter Eisentraut
Дата:
Сообщение: switching documentation build to XSLT