Re: BUG #19747: pg_dump does not pin array_nulls, so restore mangles NULL array elements

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: kehan5800(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19747: pg_dump does not pin array_nulls, so restore mangles NULL array elements
Date: 2026-10-06 20:06:47
Message-ID: 1503342.1791317207@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
>> pg_dump writes a null array element as the unquoted word NULL. Whether the
>> array input function reads that as a null depends on array_nulls, which is
>> PGC_USERSET and can be persisted with ALTER DATABASE/ROLE ... SET. The
>> dump's preamble (_doSetFixedOutputState(), src/bin/pg_dump/
>> pg_backup_archiver.c:3431) pins the other input-side settings
>> (client_encoding, standard_conforming_strings, check_function_bodies,
>> xmloption, row_security, ...) but not array_nulls, so the restoring session
>> inherits the target database's value.

> Meh. TBH, that GUC was past its shelf life ten years ago. What
> I'd rather do about this report is just summarily remove the GUC.
> If we make pg_dump issue a SET for it then we'll never be able
> to remove it.

Concretely, about like this. (BTW, another argument for doing
this rather than fixing pg_dump is that there are a ton of other
applications that will likely misbehave if array_nulls is turned
on underneath them.)

regards, tom lane

Attachment Content-Type Size
v1-0001-Remove-array_nulls-GUC-parameter.patch text/x-diff 6.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Masahiko Sawada 2026-10-06 20:14:28 Re: autovacuum: automatically propagate updated parameters
Previous Message Jiří Kavalík 2026-10-06 09:33:40 Re: Streaming decoding fails with "unexpected table_index_fetch_tuple call during logical decoding" when a relation has a TOASTed conbin (follow-up to BUG #18641)