pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14364: json_populate_record doesn't accept JSON arrays
2+ messages / 2 participants
[nested] [flat]
* BUG #14364: json_populate_record doesn't accept JSON arrays
@ 2016-10-10 20:51 joerg@bec.de
0 siblings, 1 reply; 2+ messages in thread
From: joerg@bec.de @ 2016-10-10 20:51 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 14364
Logged by: Jörg Sonnenberger
Email address: joerg@bec.de
PostgreSQL version: 9.4.9
Operating system: Linux
Description:
json_populate_record expects arrays in fields using the PG array literal
syntax, it doesn't support JSON arrays. This is highly annoying as the JSON
output functions like row_to_json will create JSON arrays, so round-trip
fidelity is lost.
Small example:
CREATE TEMPORARY TABLE test (a int, b int[]);
SELECT json_populate_record(NULL::test, '{"a": 5, "b": [1,2]}');
gives:
ERROR: malformed array literal: "[1,2]"
DETAIL: Missing "]" after array dimensions.
But
SELECT json_populate_record(NULL::test, '{"a": 5, "b": "{1,2}"}');
is accepted. Accepting JSON arrays directly would be backwards-compatible.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #14364: json_populate_record doesn't accept JSON arrays
@ 2016-10-13 20:19 Tom Lane <tgl@sss.pgh.pa.us>
parent: joerg@bec.de
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2016-10-13 20:19 UTC (permalink / raw)
To: joerg@bec.de; +Cc: pgsql-bugs
joerg@bec.de writes:
> json_populate_record expects arrays in fields using the PG array literal
> syntax, it doesn't support JSON arrays. This is highly annoying as the JSON
> output functions like row_to_json will create JSON arrays, so round-trip
> fidelity is lost.
Yeah, this has come up before; one recent discussion is at
https://www.postgresql.org/message-id/flat/CAPpdape1SieipHCyZVbgtkb5NaD00FKGjiEoqfYj%3DPi%2B9ffisg%4...
Basically, these functions weren't built to process nested structures
recursively, and making them do so is a bit more work than anyone has
seen fit to put into them yet. We'd accept a patch ...
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2016-10-13 20:19 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-10-10 20:51 BUG #14364: json_populate_record doesn't accept JSON arrays joerg@bec.de
2016-10-13 20:19 ` Tom Lane <tgl@sss.pgh.pa.us>
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