pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Kellenberger <Daniel.Kellenberger@netcetera.com>
To: Joe Conway <mail@joeconway.com>
To: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: json_to_recordset not working with camelcase json keys
Date: Thu, 17 Dec 2015 07:56:08 +0000
Message-ID: <6f30a05b5a61458aa89c2d9b033aeb1a@exchange01.one.nca> (raw)
In-Reply-To: <56709F85.1040003@joeconway.com>
References: <9e4b92c2c68d4c3b8c4cdf5aa11bc844@exchange01.one.nca>
	<56709F85.1040003@joeconway.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi Joe

Thanks for your answer, this solved our issue.
In one project we are currently switching from Oracle to PostgreSQL and are excited about the database.

Kind regards,
Daniel

-- 
Our software sets the course: http://nca.me/software

Daniel Kellenberger | daniel.kellenberger@netcetera.com | T +41 44 297 58 14 |
Netcetera AG | 8040 Zürich | Switzerland | http://netcetera.com | 

________________________________________
Von: Joe Conway <mail@joeconway.com>
Gesendet: Mittwoch, 16. Dezember 2015 00:17
An: Daniel Kellenberger; pgsql-bugs@postgresql.org
Betreff: Re: [BUGS] json_to_recordset not working with camelcase json keys

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



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (3+ messages)

Message-ID: <6f30a05b5a61458aa89c2d9b033aeb1a@exchange01.one.nca>
Permalink:  ../6f30a05b5a61458aa89c2d9b033aeb1a@exchange01.one.nca/
Also on:    postgresql.org/message-id/6f30a05b5a61458aa89c2d9b033aeb1a@exchange01.one.nca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: Daniel.Kellenberger@netcetera.com, mail@joeconway.com
  Subject: Re: json_to_recordset not working with camelcase json keys
  In-Reply-To: <6f30a05b5a61458aa89c2d9b033aeb1a@exchange01.one.nca>
  References: <9e4b92c2c68d4c3b8c4cdf5aa11bc844@exchange01.one.nca> <56709F85.1040003@joeconway.com> <6f30a05b5a61458aa89c2d9b033aeb1a@exchange01.one.nca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox