Adjust error message for CREATE STATISTICS to account for expressions

Yugo Nagata <nagata@sraoss.co.jp>

From: Yugo Nagata <nagata@sraoss.co.jp>
To: Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2026-03-24T11:34:30Z
Lists: pgsql-hackers

Attachments

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

Regards,
Yugo Nagata

-- 
Yugo Nagata <nagata@sraoss.co.jp>

Commits

  1. Split CREATE STATISTICS error reasons out into errdetails