Re: BUG #13972: jsonb_to_record cant map camelcase keys

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: zn(at)dbml(dot)dk
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13972: jsonb_to_record cant map camelcase keys
Date: 2016-02-18 17:03:23
Message-ID: 30509.1455815003@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

zn(at)dbml(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2016-02-18 17:17:15 Re: BUG #13971: SysV shm is used regardless of config
Previous Message Tom Lane 2016-02-18 17:01:09 Re: BUG #13973: Constants resolved in then/else clauses