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

From Michael Paquier
Subject Re: Adjust error message for CREATE STATISTICS to account for expressions
Date
Msg-id acXAAbIp9tfsvHxy@paquier.xyz
Whole thread Raw
In response to Re: Adjust error message for CREATE STATISTICS to account for expressions  (John Naylor <johncnaylorls@gmail.com>)
Responses Re: Adjust error message for CREATE STATISTICS to account for expressions
List pgsql-hackers
On Thu, Mar 26, 2026 at 04:22:07PM +0700, John Naylor wrote:
> I'd probably write this as "extended statistics on a single column are
> not supported" (no need to send a new patch).
>
> Any objections?

None.  I have found this error message puzzling while doing some of my
recent work for extended statistics, because extended statistics can
be created if there is a single element made of an expression in the
list given in input.

> Also, I'm leaning towards not backpatching -- I figure a user that got
> here by fat-fingering an expression is not likely to be too confused.

-    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

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?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: [PATCH v1] Fix typos in pg_bsd_indent: "dont" -> "don't" in comments Anexo: o arquivo
Next
From: Robert Haas
Date:
Subject: Re: pg_plan_advice