Re: pgbench: \gset and \aset should store SQL NULL as the null value

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pgbench: \gset and \aset should store SQL NULL as the null value
Date: 2026-09-09 05:23:35
Message-ID: aqDtV7I1UXqJ0BRz@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 08, 2026 at 10:05:31PM -0400, shihao zhong wrote:
> One doc gap: 0001 changes what \gset does with a NULL column, but the \gset
> docs say nothing about NULL. One sentence is enough, so no v3 is
> needed. Master only, no back-patch.

Bug is a term mentioned on this thread, but I don't see a need for a
backpatch based on the lack of complaints. There is also a secondary
reason regarding compatibility, even if somewhat accidental with the
handling of NULL values. HEAD seems fine enough.

> Please commit 0002 together with 0001. Patch 0001 says a captured NULL
> can be tested with IS NULL, but that test cannot tell a real NULL from
> a column holding the text 'NULL'. Only 0002 explains this.

Not sure if this is worth bothering in the docs, but I'll think more
about this point.

Similarly to Horiguchi-san's comments, I think that the tests could be
trimmed even more. I see no need for at least:
- "gset NULL interpolates as SQL NULL"
- "gset empty string stays empty"
- "gset NULL is bound as the string NULL in extended and prepared
modes"

These just act as cross-checks of the pgbench runs, that provide some
coverage due to the executions working.

At the end I would just keep the "pgbench gset command with NULL" bit,
which should be enough to cover readCommandResponse(), no? No need to
be fancy, efficient is fine and saves runtime cycles.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Clemenza Zhang 2026-09-09 05:23:38 Re: Bug: Whole-row var in indexes corrupts indexes after DDL
Previous Message Amit Kapila 2026-09-09 05:05:10 Re: Follow-up review items for update_deleted