Some doubious error messages and comments

Kyotaro Horiguchi <horikyota.ntt@gmail.com>

From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2021-04-28T08:36:33Z
Lists: pgsql-hackers

Attachments

Hello.

0001: I found some typos in a error message and a comment.

multirangetypes.c: 1420
> errmsg("range_intersect_agg must be called with a multirange")));

This "range_intersect_agg" looks like a typo of "multirange_..".

operatorcmds.c:303
> * Look up a join estimator function ny name, and verify that it has the

"ny" looks like a typo of "by".



0002: The following messages are substantially same and are uselessly
split into separate messages. I'm not sure any compiler complains
about using %zu for int, explicit casting would work in that case.

be-secure-gssapi.c:351
>	(errmsg("oversize GSSAPI packet sent by the client (%zu > %zu)",
>			(size_t) input.length,
>			PQ_GSS_RECV_BUFFER_SIZE - sizeof(uint32))));
be-secure-gssapi.c:570
>	(errmsg("oversize GSSAPI packet sent by the client (%zu > %d)",
>			(size_t) input.length,
>			PQ_GSS_RECV_BUFFER_SIZE)));



0003: The messages below seems to be a bit unclear.  I'm not sure they
worth doing.

conversioncmds.c: 130
 errmsg("encoding conversion function %s returned incorrect result for empty input",

This is not wrong at all, but another message just above is saying
that "encoding conversion function %s must return type %s".  Why
aren't we explicit here, like this?

"encoding conversion function %s must return zero for empty input"


typecmds.c:4294
>	if (requireSuper)
>		if (!superuser())
>			ereport(ERROR,
>					 errmsg("must be superuser to alter a type")));

Where, requireSuper varies depending on the set of operations but the
description looks like describing general behavior. I'm not sure but
something like the following might be better?

+		 errmsg("must be superuser to perform all operations")));
+		 errmsg("some of the operations require superuser privilege")));

Any opinions or suggestions?

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Commits

  1. Fix typos in operatorcmds.c

  2. Multirange datatypes

  3. Add ALTER OPERATOR command, for changing selectivity estimator functions.