Re: Adjust error message for CREATE STATISTICS to account for expressions - Mailing list pgsql-hackers

From John Naylor
Subject Re: Adjust error message for CREATE STATISTICS to account for expressions
Date
Msg-id CANWCAZaZeX0omWNh_ZbD_JVujzYQdRUW8UZOQ4dWh9Sg7OcAow@mail.gmail.com
Whole thread Raw
In response to Re: Adjust error message for CREATE STATISTICS to account for expressions  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Adjust error message for CREATE STATISTICS to account for expressions
Re: Adjust error message for CREATE STATISTICS to account for expressions
List pgsql-hackers
On Fri, Mar 27, 2026 at 6:23 AM Michael Paquier <michael@paquier.xyz> wrote:
> -    errmsg("extended statistics require at least 2 columns")));
> +    errmsg("extended statistics are not supported on a single column")));
>
> Now our documentation also tells that the former message is not the
> preferred project style (full sentences usually avoided in primary
> messages):
> https://www.postgresql.org/docs/devel/error-style-guide.html#ERROR-STYLE-GUIDE-GRAMMAR-PUNCTUATION

My reading of that is that hints/details need to be complete
sentences, and primary messages don't need to be. If the obvious way
to write primary message is with a complete sentence, I would say
that's fine, but I don't have a lot of context here.

> Perhaps something like "could not create extended statistics" with a
> hint describing the cause would be better..  Full sentences usually
> apply to errdetails or errhints.  If we're on it, we could just as
> well improve the whole thing, I guess?

I don't feel strongly either way, so in that case I would default to
not changing to errdetail. Looking elsewhere in this file, however, I
do see some messages with "cannot do X because ....", and I'd be more
motivated to turn those "because" phrases into errdetails.

--
John Naylor
Amazon Web Services



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: Add comments about fire_triggers argument in ri_triggers.c
Next
From: Heikki Linnakangas
Date:
Subject: Re: Better shared data structure management and resizable shared data structures