potential bug in JSON
| От | Szymon Guz |
|---|---|
| Тема | potential bug in JSON |
| Дата | |
| Msg-id | CAFjNrYu_DVc7a5W_bFGBXREYL+vjurDq0aEw8TATECGWSZp6wQ@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: potential bug in JSON
|
| Список | pgsql-hackers |
I've found a potential bug. Why the "->" operator returns JSON instead of TEXT? It doesn't make sens for me, and the documentation doesn't inform about that.
postgres=# SELECT ('{"id": 1}'::json -> 'id')::int;
ERROR: cannot cast type json to integer
LINE 1: SELECT ('{"id": 1}'::json -> 'id')::int;
postgres=# SELECT ('{"id": 1}'::json -> 'id')::text::int;
int4
------
1
(1 row)
postgres=# SELECT version();
version
---------------------------------------------------------------------------------------------------------------
PostgreSQL 9.3beta1 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3, 64-bit
(1 row)
В списке pgsql-hackers по дате отправления: