BUG #14364: json_populate_record doesn't accept JSON arrays

From: joerg(at)bec(dot)de
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14364: json_populate_record doesn't accept JSON arrays
Date: 2016-10-10 20:51:36
Message-ID: 20161010205136.1397.51557@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14364
Logged by: Jörg Sonnenberger
Email address: joerg(at)bec(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Henry Cate 2016-10-10 20:59:05 Re: BUG #14363: CASE against a literal value produces correct against, same expression against a column null doesn't
Previous Message Vitaly Burovoy 2016-10-10 20:09:19 Re: BUG #14363: CASE against a literal value produces correct against, same expression against a column null doesn't