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 CANWCAZYdyQzCoAiq9kybHT2RcnC1CgrxbCpyxeV3+KZn2xj2UA@mail.gmail.com
Whole thread
In response to Adjust error message for CREATE STATISTICS to account for expressions  (Yugo Nagata <nagata@sraoss.co.jp>)
Responses Re: Adjust error message for CREATE STATISTICS to account for expressions
List pgsql-hackers
On Tue, Mar 24, 2026 at 6:34 PM Yugo Nagata <nagata@sraoss.co.jp> wrote:
>
> Hi,
>
> I've attached a patch to adjust the error message for CREATE STATISTICS
> to account for expressions.
>
> Previously, when attempting to create extended statistics on a single column,
> the following error is raised.
>
>  ERROR:  extended statistics require at least 2 columns
>
> However, this message assumed only columns. In reality, an expression on a
> single column is also allowed, so two columns are not necessarily required.
> Thgis patch updates the message to:
>
>  ERROR:  extended statistics require at least 2 columns or an expression

I'm ambivalent about this. Instead of trying to document all the
possible valid possibilities (which may get out of date again), maybe
we can say that it's not allowed on a single column?

--
John Naylor
Amazon Web Services



pgsql-hackers by date:

Previous
From: Andrew Jackson
Date:
Subject: Add http connection service file functionality
Next
From: Peter Geoghegan
Date:
Subject: Re: index prefetching