From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Daniel Kellenberger <Daniel(dot)Kellenberger(at)netcetera(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: json_to_recordset not working with camelcase json keys |
Date: | 2015-12-15 23:17:25 |
Message-ID: | 56709F85.1040003@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 12/15/2015 01:46 PM, Daniel Kellenberger wrote:
> We tried to extract from a json with camel case keys values, but
> unfortunatelly they are not mapped.
>
> Testcase: (PostgreSQL 9.4.5)
>
> select * from
> json_to_recordset('[{"aB":1,"bC":"foo"},{"aB":"2","cD":"bar"}]') as x(aB
> int, bC text);
Not a bug, I believe. You probably meant this:
select * from json_to_recordset('[{"aB":1,"bC":"foo"},
{"aB":"2","cD":"bar"}]')
as x("aB" int, "bC" text, "cD" text);
aB | bC | cD
----+-----+-----
1 | foo |
2 | | bar
(2 rows)
Unquoted identifiers are lowercased in postgres, so for camel case
identifiers you would need double quotes.
HTH,
Joe
--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2015-12-15 23:46:51 | Re: BUG #13666: REASSIGN OWNED BY doesn't affect the relation underlying composite type |
Previous Message | Tom Lane | 2015-12-15 22:16:55 | Re: BUG #13818: PostgreSQL crashes after cronjob runs as "postgres" |