pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #16092: json[b]_to_recordset and json[b]_populate_record do not read properties with mixed-case names
2+ messages / 2 participants
[nested] [flat]
* BUG #16092: json[b]_to_recordset and json[b]_populate_record do not read properties with mixed-case names
@ 2019-10-31 14:29 PG Bug reporting form <noreply@postgresql.org>
2019-10-31 14:41 ` Re: BUG #16092: json[b]_to_recordset and json[b]_populate_record do not read properties with mixed-case names Sergei Kornilov <sk@zsrv.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2019-10-31 14:29 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: dweinhardt78+pgsql-bugs@gmail.com
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;
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #16092: json[b]_to_recordset and json[b]_populate_record do not read properties with mixed-case names
2019-10-31 14:29 BUG #16092: json[b]_to_recordset and json[b]_populate_record do not read properties with mixed-case names PG Bug reporting form <noreply@postgresql.org>
@ 2019-10-31 14:41 ` Sergei Kornilov <sk@zsrv.org>
0 siblings, 0 replies; 2+ messages in thread
From: Sergei Kornilov @ 2019-10-31 14:41 UTC (permalink / raw)
To: dweinhardt78+pgsql-bugs@gmail.com <dweinhardt78+pgsql-bugs@gmail.com>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Hello
Its correct. Identifier name definition should be quoted if you want use uppercase symbols:
SELECT x.* FROM jsonb_to_recordset('[{"aName": "foo"}]'::jsonb) AS x("aName" text);
aName
-------
foo
unquoted names are always folded to lower case and therefore do not match. Per lexical structure documentation: https://www.postgresql.org/docs/current/sql-syntax-lexical.html
regards, Sergei
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-10-31 14:41 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-10-31 14:29 BUG #16092: json[b]_to_recordset and json[b]_populate_record do not read properties with mixed-case names PG Bug reporting form <noreply@postgresql.org>
2019-10-31 14:41 ` Sergei Kornilov <sk@zsrv.org>
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