BUG #19643: Output of jsonb_populate_recordset not consistent with documentation description
BUG #19643: Output of jsonb_populate_recordset not consistent with documentation description
От:
PG Bug reporting form <noreply@postgresql.org>
Дата:
The following bug has been logged on the website:
Bug reference: 19643
Logged by: Balaji Venkatesan
Email address: yishundinesh@gmail.com
PostgreSQL version: 18.6
Operating system: Ubuntu
Description:
As per the documentation jsonb_populate_record "Expands the object in
from_json to a row whose columns match the record type defined by base".
The example given the documentation is working fine, but if I replace
null::myrow with Row(('a'::text,'b'::text), the output discards
from_json(second argument completely)
First argument's value is being used instead of using it as a key
Eg:
select * from
jsonb_populate_recordset(ROW('a'::text,'b'::text),'[{"a":"test","b":"55"}]')
as (a text, b text)
Output::
a,b
Expected output:
test,55
Re: add list of major features to the v19 release notes
От:
Michael Banck <mbanck@gmx.net>
Дата:
Hi, yay for having this in place earlier this time. Some comments: On Wed, Jul 01, 2026 at 04:38:14PM -0500, Nathan Bossart wrote: > + > + > + Logical replication now > + replicates sequence values, > + and it can be enabled without a server restart when > + is set to replica. > + > + Maybe it's because I'm not a native speaker, but I tripped over the second part and parsed it as a function of the replicate sequence values, not logical replication. Would it help readers to drop the "it", i.e. write "and can be enabled [...]"? > + > + > + Faster performance in many areas, including automatic scaling of the > + number of I/O worker processes, > + quicker foreign-key checks, and further planning and execution > + optimizations. > + > + (This is kinda a catch-all statement and might go well as last item, dunno). > + > + > + Data checksums can now be > + enabled or disabled while the database is running. > + > + I think we still don't say "the database" when we talk about a server/instance/cluster. It should either be "the cluster" or "the database server". > + > + > + and can now > + change or remove data for just part of a time range via the new > + FOR PORTION OF clause. > + > + I think this sentence should include something about temporal ranges/keys, or maybe just s/time range/temporal range/? Michael
Re: BUG #19643: Output of jsonb_populate_recordset not consistent with documentation description
От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Fri, Aug 28, 2026 at 8:57 AM PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:
Bug reference: 19643
Logged by: Balaji Venkatesan
Email address: yishundinesh@gmail.com
PostgreSQL version: 18.6
Operating system: Ubuntu
Description:
As per the documentation jsonb_populate_record "Expands the object in
from_json to a row whose columns match the record type defined by base".
The example given the documentation is working fine, but if I replace
null::myrow with Row(('a'::text,'b'::text), the output discards
from_json(second argument completely)
First argument's value is being used instead of using it as a key
Eg:
select * from
jsonb_populate_recordset(ROW('a'::text,'b'::text),'[{"a":"test","b":"55"}]')
as (a text, b text)
Output::
a,b
Expected output:
test,55
It doesn't discard the second argument - but your record type doesn't have either "a" or "b" columns defined so no matches are found.
Your base object has only one unnamed composite typed (two text fields) column. Since the object itself is not null you've specified a default value for that column which is what you see in the output.
In short, this is working as documented. What you intended with writing row(...) simply isn't how the system works.
Use json_to_record or json_to_recordset if you want to specify the structure of the output explicitly inline. The populate variants are meant to be used when actual types exist within the system (usually because a corresponding table exists).
David J.