Re: BUG #13972: jsonb_to_record cant map camelcase keys - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #13972: jsonb_to_record cant map camelcase keys
Date
Msg-id 30509.1455815003@sss.pgh.pa.us
Whole thread Raw
In response to BUG #13972: jsonb_to_record cant map camelcase keys  (zn@dbml.dk)
List pgsql-bugs
zn@dbml.dk writes:
> Try the following:

> select * from json_to_record('{"aA":1,"bB":[1,2,3],"c":"bar"}') as x(aA int,
> bB text, c text)

> first two columns will be empty.

You need to do it like this:

select * from json_to_record('{"aA":1,"bB":[1,2,3],"c":"bar"}') as x("aA" int,
"bB" text, c text);
 aA |   bB    |  c
----+---------+-----
  1 | [1,2,3] | bar
(1 row)

Without the quotes, the SQL names aA etc are case-folded to aa etc.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #13973: Constants resolved in then/else clauses
Next
From: Jeff Janes
Date:
Subject: Re: BUG #13971: SysV shm is used regardless of config