Good catch!

At Tue, 18 Aug 2026 14:07:02 +0900, Shinya Kato <[email protected]> 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


Reply via email to