| From: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
|---|---|
| To: | shinya11(dot)kato(at)gmail(dot)com |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: pgbench: \gset and \aset should store SQL NULL as the null value |
| Date: | 2026-08-18 07:46:44 |
| Message-ID: | 20260818.164644.884477378506001932.horikyota.ntt@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Good catch!
At Tue, 18 Aug 2026 14:07:02 +0900, Shinya Kato <shinya11(dot)kato(at)gmail(dot)com> wrote in
> The patch is attached. Thoughts?
I think the code changes look good. Since pgbench variables can hold
NULL values, I think it is correct to handle SQL NULL this way. On the
other hand, I think the tests could be reduced somewhat. For example,
I don't think the tests for \aset and sorting are particularly
necessary.
I think this change can also be seen as making \gset and \aset behave
as one would naturally expect from the existing documentation: an SQL
NULL result is stored as a pgbench NULL value. If so, I wonder whether
additional documentation is needed at all. I think documentation of
the existing behavior would be better handled in a separate patch from
this change.
> The patch checks PQgetisnull() and assigns the null value, exactly as
> \set varname NULL does. An empty string returned by the server still
> aborts the client when used in an expression.
This happens with any string that cannot be converted to a value type
supported by pgbench expressions. So I think it would be possible to
replace an empty string returned by PQgetvalue() with "null", but if
we are going to check for NULL anyway, I think it is better to assign
NULL directly.
Regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bingshuai Li | 2026-08-18 07:48:49 | Re: Logical Replication - revisit `is_table_publication` function implementation |
| Previous Message | Hayato Kuroda (Fujitsu) | 2026-08-18 07:42:56 | RE: Proposal: Conflict log history table for Logical Replication |