Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt
Date: 2025-08-22 10:00:17
Message-ID: CALdSSPjb98dqy6bq4OmS23c7yYUDNET+pX6=G=SUFUQKe_ULmA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 22 Aug 2025 at 14:46, Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
>
> On 2025-Aug-21, Kirill Reshke wrote:
>
> > I wouldn’t say this is misleading, but " a single relation" is indeed
> > not precise enough. IMO we need a more precise term to distinguish
> > regular relation and table func.
>
> I'm not sure. See the definition of relation in the glossary:
> https://www.postgresql.org/docs/18/glossary.html#GLOSSARY-RELATION
>
> The generic term for all objects in a database that have a name and a
> list of attributes defined in a specific order. Tables, sequences,
> views, foreign tables, materialized views, composite types, and
> indexes are all relations.
>
> More generically, a relation is a set of tuples; for example, the
> result of a query is also a relation.
>
> In PostgreSQL, Class is an archaic synonym for relation.
>
> (I wonder why this says "generically" rather than "generally". Is that
> word choice a mistake?) Maybe in the "For example" clause we can also
> mention table functions.
>
> --
> Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

I am sorry: I am not following. CREATE STATISTIC will work only for
single HEAP (or other AM) relations. So, for "simple regular tables"
as one can say (not tablefunc).

You say: relation is a term for both HEAP relation, tablefunc relation
and much more.
I say: "a single relation" in the error message is not precise enough.

Where do we disagree?

Anyway, I would say correct error message here should be:

```
db=# CREATE STATISTICS alt_stat2 ON a, b FROM tftest(1);
ERROR: cannot define statistics for relation "alt_stat2"
DETAIL: This operation is not supported for query result.
```

--
Best regards,
Kirill Reshke

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2025-08-22 10:17:19 Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt
Previous Message Álvaro Herrera 2025-08-22 09:59:31 Re: Remove unneeded cast in heap_xlog_lock.