pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: dweinhardt78+pgsql-bugs@gmail.com
Subject: BUG #16092: json[b]_to_recordset and json[b]_populate_record do not read properties with mixed-case names
Date: Thu, 31 Oct 2019 14:29:06 +0000
Message-ID: <16092-a31312333f90cf85@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      16092
Logged by:          Dirk Weinhardt
Email address:      dweinhardt78+pgsql-bugs@gmail.com
PostgreSQL version: 11.5
Operating system:   Alpine Linux
Description:        

Using Docker container image postgres:11.5-alpine pulled on 2019-10-31
14:12:00 CET.

Given this fairly simple piece of JSON data: [{"aName": "foo"}]

When any of these queries is executed:
SELECT x.* FROM jsonb_to_recordset('[{"aName": "foo"}]'::jsonb) AS x(aName
text);
SELECT x.* FROM json_to_recordset('[{"aName": "foo"}]'::json) AS x(aName
text);
SELECT x.* FROM jsonb_to_recordset('[{"aname": "foo"}]'::jsonb) AS x(aname
text);
SELECT x.* FROM json_to_recordset('[{"aname": "foo"}]'::json) AS x(aname
text);

Then the output should be:
aname (text)
-----------------
foo

But for the first and the second query (the ones with mixed-case property
names) the actual output is:
aname (text)
-----------------
NULL

The same issue also exists with these queries:
DROP TYPE IF EXISTS x;
CREATE TYPE x AS (aName text);
SELECT x.* FROM jsonb_array_elements('[{"aName": "foo"}]'::jsonb) AS s,
jsonb_populate_record(NULL::x, s.value) AS x;
SELECT x.* FROM json_array_elements('[{"aName": "foo"}]'::json) AS s,
json_populate_record(NULL::x, s.value) AS x;



view thread (2+ messages)  latest in thread

Message-ID: <16092-a31312333f90cf85@postgresql.org>
Permalink:  ../16092-a31312333f90cf85@postgresql.org/
Also on:    postgresql.org/message-id/16092-a31312333f90cf85@postgresql.org

 · 

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: noreply@postgresql.org, dweinhardt78+pgsql-bugs@gmail.com
  Subject: Re: BUG #16092: json[b]_to_recordset and json[b]_populate_record do not read properties with mixed-case names
  In-Reply-To: <16092-a31312333f90cf85@postgresql.org>
  References: <16092-a31312333f90cf85@postgresql.org>

* 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