Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Kirill Reshke <reshkekirill(at)gmail(dot)com>
Subject: Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt
Date: 2026-05-15 14:04:52
Message-ID: agcVPirhBaUg3iqo@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Dec-17, jian he wrote:

> diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
> index bc7adba4a0f..326d30cfb2f 100644
> --- a/src/include/nodes/parsenodes.h
> +++ b/src/include/nodes/parsenodes.h
> @@ -3551,6 +3551,10 @@ typedef struct CreateStatsStmt
> List *stat_types; /* stat types (list of String) */
> List *exprs; /* expressions to build statistics on */
> List *relations; /* rels to build stats on (list of RangeVar) */
> + List *from_clause; /* FROM clause ((list of RangeVar)) */
> + List *rtable; /* It’s not derived directly from the
> + * parser, instead it comes from parse
> + * analysis. (list of RangeTblEntry) */
> char *stxcomment; /* comment to apply to stats, or NULL */
> bool transformed; /* true when transformStatsStmt is finished */
> bool if_not_exists; /* do nothing if stats name already exists */

I'm unconvinced about this, and I wonder if it would make sense to have
two separate nodes, one which is pre-transform (direct out of parser)
and another which is post-transform. Would that things a bit simpler?

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"We have labored long to build a heaven, only (Prof. Milton Glass)
to find it populated with horrors" (Watchmen, Alan Moore)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2026-05-15 14:06:09 Re: [PATCH] refint: Avoid reusing cascade UPDATE plans.
Previous Message Nisha Moond 2026-05-15 13:32:03 Re: Support EXCEPT for TABLES IN SCHEMA publications