From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
Cc: | 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: | 2025-09-04 04:54:37 |
Message-ID: | CACJufxGmqkifdj0fBoNhDKoHFgz3v_qo1v5nDDqj-gY1-YC3hA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Aug 29, 2025 at 8:48 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
>
> > > Alternatively, maybe the right fix is to move the parse-analysis
> > > work into CreateStatistics altogether. I think there is not a
> > > very good argument for ProcessUtilitySlow doing all that stuff.
> > > It's supposed to mainly just be a dispatching switch(), IMO.
> >
> > seems doable.
> > transformStatsStmt, CreateStatistics both used only twice, refactoring
> > arguments should be fine.
> > please check the attached POC, regress tests also added.
>
> Yeah, I like how this turned out. I found out this was introduced in
> commit a4d75c86bf15.
Previously, CreateStatistics and ProcessUtilitySlow opened the same relation
twice with a ShareUpdateExclusiveLock. This refactor ensures the relation is
opened with ShareUpdateExclusiveLock only once and also reduces redundant error
checks.
The logic is now more intuitive: we first error checking
CreateStatsStmt->relations and then call transformStatsStmt to parse analysis
CreateStatsStmt->exprs.
please check the attached refactor CreateStatsStmt.
Attachment | Content-Type | Size |
---|---|---|
v3-0001-refactor-CreateStatsStmt.patch | text/x-patch | 5.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2025-09-04 04:59:36 | Re: pg_upgrade: transfer pg_largeobject_metadata's files when possible |
Previous Message | Thomas Munro | 2025-09-04 04:35:36 | Re: Should io_method=worker remain the default? |