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: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adjust error message for CREATE STATISTICS to account for expressions
Date: 2026-03-31 14:47:45
Message-ID: 20260331234745.80572b0c208cac1f13837011@sraoss.co.jp
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 30 Mar 2026 10:21:54 +0700
John Naylor <johncnaylorls(at)gmail(dot)com> wrote:

> On Sat, Mar 28, 2026 at 1:04 PM Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:
> >
> > On Fri, 27 Mar 2026 09:50:07 +0000
> > Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
>
> > > If we were to give more detail, it should probably be to point out
> > > that regular statistics will already be built for single columns,
> > > which is why single-column extended statistics would be redundant. So
> > > perhaps something like this:
> > >
> > > Error: cannot create extended statistics on a single column
> > > Detail: Univariate statistics are already built for each individual
> > > table column.
> >
> > That makes sense to me.
> >
> > Using an errdetail to explain the reason sounds reasonable.
>
> Works for me.
>
> > > > On Fri, 27 Mar 2026 07:45:37 +0700
> > > > John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
> > > > > 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.
>
> Did you also want to try tackling this while we're here?

Yes, that sounds good to me.

In particular, the following suggestion from Dean Rasheed seems like a
good approach:

> Error: cannot create extended statistics on a single column
> Detail: Univariate statistics are already built for each individual
> table column

Regards,
Yugo Nagata

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniil Davydov 2026-03-31 14:49:59 Re: Get rid of redundant StringInfo accumulation
Previous Message jian he 2026-03-31 14:47:37 Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions