Re: alter table add x wrong error position

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter table add x wrong error position
Date: 2024-01-08 06:17:38
Message-ID: CAKFQuwbs_1ask7XCFFzBu_bKodU=rRy9v5Nn_NBH73zcRNBFcQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sunday, January 7, 2024, jian he <jian(dot)universality(at)gmail(dot)com> wrote:

> hi.
> Maybe this is a small printout err_position bug.
>
> create table atacc2 ( test int, a int, b int) ;
> success tests:
> alter table atacc2 add CONSTRAINT x PRIMARY KEY (id, b );
> alter table atacc2 add CONSTRAINT x PRIMARY KEY (id, b a);
> alter table atacc2 add CONSTRAINT x PRIMARY KEYa (id, b);
>
> tests have problem:
> alter table atacc2 add constraints x unique (test, a, b);
> ERROR: syntax error at or near "("
> LINE 1: alter table atacc2 add constraints x unique (test, a, b);
>
> ^
> ADD either following with the optional keyword "COLUMN" or
> "CONSTRAINT" as the doc.
> so I should expect the '^' point at "constraints"?
>

It’s finding “… add column_name data_type column_constraint” then dies at
the parenthesis. So indeed the care t should be pointing where it probably
is, at the parenthesis that the error is referring to.

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2024-01-08 06:22:14 Commitfest 2024-01 first week update
Previous Message Dilip Kumar 2024-01-08 06:09:39 Re: Synchronizing slots from primary to standby