Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-22 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > Yeah, AFAIR I wrote it (or at least heavily edited the original to get > to that), and I was trying to convey exactly those two ideas. If you > want to propose improvements, they're very welcome. Hmmm ... maybe something like Mathematically, a "rela

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-22 Thread Álvaro Herrera
On 2025-Aug-22, Kirill Reshke wrote: > 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). Ah yeah, you're right, I think we should say "a single table", or maybe "a single tab

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-22 Thread Álvaro Herrera
On 2025-Aug-22, Tom Lane wrote: > I'm not certain, but I think that our use of "relation" to mean > "an object with a pg_class entry" is a Postgres-ism. I do know > that the meaning of "a set of tuples" is widely used, as that's > where the term "relational database" comes from. Maybe whoever >

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-22 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > 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 orde

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-22 Thread Richard Guo
On Fri, Aug 22, 2025 at 6:46 PM Álvaro Herrera wrote: > 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

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-22 Thread jian he
hi. will + if (!IsA(rln, RangeVar)) + ereport(ERROR, + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("CREATE STATISTICS only supports regular tables, materialized views, foreign table

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-22 Thread Kirill Reshke
On Fri, 22 Aug 2025 at 14:46, Álvaro Herrera 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. Se

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-22 Thread Álvaro Herrera
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.postgresq

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-21 Thread Tom Lane
Kirill Reshke writes: > On Thu, 21 Aug 2025 at 17:00, jian he wrote: >> RangeVar *rel = (RangeVar *) linitial(stmt->relations); >> if (!IsA(rel, RangeVar)) > These two lines are weird. Looks like linitial(stmt->relations) > should be assigned to variable with type Node* first? We take that s

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-21 Thread Kirill Reshke
On Thu, 21 Aug 2025 at 17:00, jian he wrote: > > hi. Hi! > RangeVar *rel = (RangeVar *) linitial(stmt->relations); > if (!IsA(rel, RangeVar)) These two lines are weird. Looks like linitial(stmt->relations) should be assigned to variable with type Node* first? > > for example: > > create

misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-21 Thread jian he
hi. while reviewing other work, some error messages in src/backend/tcop/utility.c seem not accurate. static void ProcessUtilitySlow(ParseState *pstate, PlannedStmt *pstmt, const char *queryString, ProcessUtilityContext context,