Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a8yrD-0002fW-I6 for pgsql-bugs@arkaria.postgresql.org; Tue, 15 Dec 2015 23:18:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a8yrC-0003FV-7T for pgsql-bugs@arkaria.postgresql.org; Tue, 15 Dec 2015 23:18:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a8yqZ-0002YJ-TB for pgsql-bugs@postgresql.org; Tue, 15 Dec 2015 23:17:31 +0000 Received: from 104-190-1-44.lightspeed.sndgca.sbcglobal.net ([104.190.1.44] helo=joeconway.com) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1a8yqW-0005U7-Fy for pgsql-bugs@postgresql.org; Tue, 15 Dec 2015 23:17:31 +0000 Received: from [72.214.29.243] (account jconway@joeconway.com HELO [192.168.4.41]) by joeconway.com (CommuniGate Pro SMTP 6.1.4) with ESMTPSA id 15977129; Tue, 15 Dec 2015 15:17:26 -0800 Subject: Re: json_to_recordset not working with camelcase json keys To: Daniel Kellenberger , "pgsql-bugs@postgresql.org" References: <9e4b92c2c68d4c3b8c4cdf5aa11bc844@exchange01.one.nca> From: Joe Conway Message-ID: <56709F85.1040003@joeconway.com> Date: Tue, 15 Dec 2015 15:17:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <9e4b92c2c68d4c3b8c4cdf5aa11bc844@exchange01.one.nca> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eFmF0nV9HsRpLmCt74L860vOLbCijebM4" X-Pg-Spam-Score: -0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --eFmF0nV9HsRpLmCt74L860vOLbCijebM4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > Testcase: (PostgreSQL 9.4.5) >=20 > select * from > json_to_recordset('[{"aB":1,"bC":"foo"},{"aB":"2","cD":"bar"}]') as x(a= B > 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 --=20 Crunchy Data - http://crunchydata.com PostgreSQL Support for Secure Enterprises Consulting, Training, & Open Source Development --eFmF0nV9HsRpLmCt74L860vOLbCijebM4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJWcJ+FAAoJEDfy90M199hly4MP/jMLULn1pjah6Mgk12Lc98v5 87ap4Rs1cBrGepKlEMX4/HyzLHcVHyY1losIUQxGFxPAVKjrhiMNLc8svDZGy8yF KdJGYrbLaOcIGY80XTEh62tX9Zvncf2EPGZTUhP1Dq+YEEP1pL+BacNjOY4EyZFW VEeq97tTY5mZtYJB0lzsGaHTqUnZmogLeru2n2Y6OtqKPBo/kxk8zJrToDHkFrbJ cTUj1iW+gxbVqL9dQR9o+JpAHjsvwzLHxTcpJdU9xnGgLYjslKLk6wQU1juT9LDP VXtdLATUD3+1So4oKBlsLLdjoITfzsGIriJmaUcsIzm44Q5OEJttedILzJzUlIQ0 9tzfX9eV44jsi52Rzkak8EE8U6lQ362ReAwP/6vJFkWPFoocxdydHUUCR1nf1utC lGJoFxmn82jCsKSW+cQGgJ9RYsATfNyVug0X4L560bfFUqoDLDyLJZQOLI756SMU MzUhZT1jPCoNMgnAwYNhlEhGAoyOENP42ok2haFEYT93g+jVFmKcgjrLipk9RPBB O2siFuLISpHyBX37ZSHhdGlgtzJgHw1wyerPi9SJISZAMyRpFMVT3LWXjDIQzgvF +FFmwFIAjhHmp7zjCn/Q7C1MWEbazKf1QMUvS5EP0KCt0H/dy0HQ1TWXY5AGXHWj jgJMh5HlnIZ/6G/sErxe =yJjT -----END PGP SIGNATURE----- --eFmF0nV9HsRpLmCt74L860vOLbCijebM4--