| From: | Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> |
|---|---|
| To: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
| Cc: | John Naylor <johncnaylorls(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-28 06:04:25 |
| Message-ID: | 20260328150425.79219072e05f12e6b911b5e7@sraoss.co.jp |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, 27 Mar 2026 09:50:07 +0000
Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> On Fri, 27 Mar 2026 at 04:46, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:
> >
> > On Fri, 27 Mar 2026 07:45:37 +0700
> > John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
> >
> > > On Fri, Mar 27, 2026 at 6:23 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> > > > - 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
> > >
> > > My reading of that is that hints/details need to be complete
> > > sentences, and primary messages don't need to be. If the obvious way
> > > to write primary message is with a complete sentence, I would say
> > > that's fine, but I don't have a lot of context here.
> > >
> > > > 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?
> > >
> > > I don't feel strongly either way, so in that case I would default to
> > > not changing to errdetail. 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.
> >
> > I don't have a strong preference here, so I'm fine with either approach.
> > I also agree that moving "because ..." into errdetails in some longer
> > messages makes sense.
>
> I don't think it should be a hint, because that's more for suggestions
> on how to fix the problem.
>
> Given that the user just tried to create extended statistics on a
> single column, they're probably not interested in expression
> statistics or multivariate statistics, so a single short "not
> supported" error seems sufficient.
>
> 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.
--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Yugo Nagata | 2026-03-28 07:18:02 | Re: Track skipped tables during autovacuum and autoanalyze |
| Previous Message | Masahiko Sawada | 2026-03-28 05:36:51 | Re: pg_buffercache: Add per-relation summary stats |