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-27 07:01:58 |
Message-ID: | CACJufxGfbPfWLjcEz33G9eW_epDW0UDi2H05i9eSTPKGJ4rxSA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Dec 25, 2024 at 5:29 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Mon, Dec 16, 2024 at 05:25:45PM +0800, jian he wrote:
> > i've split into 3 patches, feel free to merge them in any way.
> > v12-0001: add error position for ATPrepAlterColumnType.
>
> For this one, why don't you do the same for undefined columns and
> USING with generated columns at least? This looks half-baked.
>
I think I understand what you mean.
please check attached for changes within ATPrepAlterColumnType
> > v12-0002: add error position for these 3 functions:
> > transformColumnDefinition, transformAlterTableStmt, transformTableConstraint.
>
> ERROR: column "c" of relation "itest4" does not exist
> +LINE 1: ALTER TABLE itest4 ALTER COLUMN c ADD GENERATED ALWAYS AS ID...
> + ^
>
> This one is kind of confusing? The part that matters for the error is
> the column that does not exist, not the ADD GENERATED.
>
I agree this is confusing.
while looking at 0002:
errmsg("conflicting NO INHERIT declarations for not-null constraints
on column \"%s\"", column->colname)
add parser_errposition
will not be very helpful. i think we need an errhint.
for example:
create table notnull_tbl_fail (a int primary key constraint foo not
null no inherit);
ERROR: conflicting NO INHERIT declarations for not-null constraints
on column "a"
the error message didn't explicitly say that the primary key imply a
not-null inherit constraint.
Maybe we can change to
errmsg("conflicting NO INHERIT declarations for not-null constraints
on column \"%s\"", column->colname),
errhint("specified primary key or identity sequence imply an inherited
not-null constraint will be created")
what do you think?
Attachment | Content-Type | Size |
---|---|---|
v13-0001-add-error-position-for-ATPrepAlterColumnType.patch | application/x-patch | 8.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2024-12-27 07:37:02 | Re: An improvement of ProcessTwoPhaseBuffer logic |
Previous Message | Vladlen Popolitov | 2024-12-27 06:57:12 | Re: Windows meson build |