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