Re: SQL/JSON: functions

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: SQL/JSON: functions
Дата
Msg-id 2c692328-02aa-413d-de32-1e2df76b89af@dunslane.net
обсуждение исходный текст
Ответ на Re: SQL/JSON: functions  (Himanshu Upadhyaya <upadhyaya.himanshu@gmail.com>)
Список pgsql-hackers
On 12/9/21 09:04, Himanshu Upadhyaya wrote:
>
>
>
> 2)
> I am not sure if below is required as per SQL standard, ORACLE is
> allowing to construct JSON_OBJECT bases on the records in the table as
> below, but postgres parser is not allowing:
> create table test (id varchar(10), value int);
> insert into test values ('a',1);
> insert into test values ('b',2);
> insert into test values ('c',3);
> select json_object(*) from test; --postgres does not support
> postgres=# select json_object(*) from test;
> ERROR:  syntax error at or near "*"
> LINE 1: select json_object(*) from test;
>
>

You can spell that a bit differently today, e.g.

    select to_json(r) from test r;

I don't know either if it's in the spec, but building in support for *
in this context seems likely to be fairly complex and have very little
added utility.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com




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

Предыдущее
От: Melanie Plageman
Дата:
Сообщение: Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?)
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: pg_upgrade should truncate/remove its logs before running