Re: Adjust error message for CREATE STATISTICS to account for expressions

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adjust error message for CREATE STATISTICS to account for expressions
Date: 2026-03-25 04:15:48
Message-ID: 20260325131548.4c9a0c8d05a422021b1ba76c@sraoss.co.jp
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 25 Mar 2026 08:24:40 +0700
John Naylor <johncnaylorls(at)gmail(dot)com> wrote:

> On Tue, Mar 24, 2026 at 6:34 PM Yugo Nagata <nagata(at)sraoss(dot)co(dot)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?

Thank you for the suggestion. I agree that this is a simpler approach,
so I've attached a revised patch.

Regards,
Yugo Nagata

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
v2-Adjust_error_message_for_CREATE_STATISTICS.patch text/x-diff 623 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2026-03-25 04:24:51 Re: Track skipped tables during autovacuum and autoanalyze
Previous Message David Rowley 2026-03-25 04:10:40 Re: Avoid multiple calls to memcpy (src/backend/access/index/genam.c)