Re: Pass ParseState as down to utility functions.

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Pass ParseState as down to utility functions.
Date: 2024-12-16 09:25:45
Message-ID: CACJufxHdu5qD9eM0KCMvZFK=Uut+PXOj2XwmCHb7-=W+sStVKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 16, 2024 at 2:15 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> - likeType = typenameType(NULL, defGetTypeName(likeTypeEl), NULL);
> + likeType = typenameType(pstate, defGetTypeName(likeTypeEl), NULL);
>
> The only test impacted by this change is the CREATE TYPE (LIKE) in
> float8. It seems like this should be separated as a change of its own
> as it impacts its own command.
>
> For the rest, we're just manipulating ATExecAddOf(),
> ATPrepAlterColumnType() and ATExecAlterColumnType(). FWIW, I'm
> feeling annoyed with these new make_parsestate() calls, also knowing
> that we do it twice for the prep and exec parts of AlterColumnType.
> Perhaps that's fine at the end, that's just an increase of calls to
> make_parsestate(), still...
>

I've removed code changes related to ATExecAddOf.
ATPrepAlterColumnType will catch most of the error, so
ATExecAlterColumnType related change is not necessary.

i've split into 3 patches, feel free to merge them in any way.
v12-0001: add error position for ATPrepAlterColumnType.

v12-0002: add error position for these 3 functions:
transformColumnDefinition, transformAlterTableStmt, transformTableConstraint.

v12-0003: add error position for these 2 functions:
DefineType, transformOfType

> > like this command will fail, so we don't need to change
> > create_domain.sgml synopsis section?
>
> Yep, right. I was getting the impression that it would be possible to
> have these ones go through with the parser allowed them when I looked
> at that last Thursday. Will double-check to be sure.
> --
v6-0001-print-out-error-position-for-some-DDL-command.patch
at https://postgr.es/m/CACJufxGQtN2YzecMx=Odk8+kCTeoN7f=M_kM5e05UDW1H1PbkA@mail.gmail.com
have extensive tests.

Attachment Content-Type Size
v12-0001-add-error-position-for-ATPrepAlterColumnType.patch text/x-patch 4.5 KB
v12-0003-add-error-position-for-these-two-functions.patch text/x-patch 3.4 KB
v12-0002-add-error-position-for-these-3-functions.patch text/x-patch 8.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message eng eng 2024-12-16 09:58:52 Re: Do not scan index in right table if condition for left join evaluates to false using columns in left table
Previous Message John Naylor 2024-12-16 09:02:19 Re: Sort functions with specialized comparators