From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: easteregg@verfriemelt.org
Subject: BUG #15999: jsonb_populate_record fails with array column
Date: Tue, 10 Sep 2019 09:55:06 +0000
Message-ID: <15999-26ff3cac50876c60@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15999
Logged by: Richard
Email address: easteregg@verfriemelt.org
PostgreSQL version: 9.6.15
Operating system: Debian / Windows
Description:
given the following simplified table with one row inserted:
> create table testa ( id serial, test text[] default
'{"test","test2"}'::text[] );
> insert into testa values (default);
when we try to populate a record of testa type we run into trouble with
postgres in version 9.6.15
> select jsonb_populate_record(null::testa , to_jsonb(testa)) FROM testa;
ERROR: 22P02: malformed array literal: "["test", "test2"]"
DETAIL: "[" must introduce explicitly-specified array dimensions.
LOCATION: array_in, arrayfuncs.c:269
with postgres 10 and higher we get the expected result:
> select jsonb_populate_record(null::testa , to_jsonb(testa)) FROM testa;
jsonb_populate_record
═════════════════════
(1,"{test,test2}")
(1 row)
whe the array column is null, and therefor no contained array in the jsonb
representation, everything works fine under 9.6.15
> update testa set test = null;
> select jsonb_populate_record(null::testa , to_jsonb(testa)) FROM testa;
jsonb_populate_record
═════════════════════
(1,)
(1 row)
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, easteregg@verfriemelt.org
Subject: Re: BUG #15999: jsonb_populate_record fails with array column
In-Reply-To: <15999-26ff3cac50876c60@postgresql.org>
References: <15999-26ff3cac50876c60@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