Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rMixF-006C2r-A6 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jan 2024 06:17:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rMixE-002bEF-4I for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jan 2024 06:17:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rMixD-002bE6-RB for pgsql-hackers@lists.postgresql.org; Mon, 08 Jan 2024 06:17:43 +0000 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rMixB-000QQQ-0c for pgsql-hackers@postgresql.org; Mon, 08 Jan 2024 06:17:43 +0000 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-59502aa878aso932471eaf.1 for ; Sun, 07 Jan 2024 22:17:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704694659; x=1705299459; darn=postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YhM2+nLyYsppDjvtyA3OHZPykMsLDvcIy9OZjv7j1Ak=; b=DFwB+hgB/cvI8oa5nkpl0cGtkEcK7RniLCYh8hh3sE4QxNtd0s3EY5Oqti6Iiz8h0d ClRMUS1cifEQQSIoPOEM22QPgvbTosSYpJACbou4ELFE1zibjmQwWYdo2nWwg3S29tpZ 0qhREKd3JehfL4uxvU4u26XD9rybXlr/4UmXMSkrivQSer6tm+FIwKLhC5hKKRKr4aPW jm1irzlignolM6WrfFObrOltnkworjw7/K919F1WzHkTEde9xpyY9s8VWx7YtnBahp0n cwibalFyZRdgOae4zypet/QjG3AKQJ6hUOAbAqf2REgEIuzLfPlfZSvGGvTNpPA433ce bpCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704694659; x=1705299459; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YhM2+nLyYsppDjvtyA3OHZPykMsLDvcIy9OZjv7j1Ak=; b=ROTiVmlxNnBG9PvVNFaG1hARzZNcUY9/CGCps9MMMaVPKugd1ehaoLoxgnzgOfwtYM tw1RXLC4uCAidP6In+tOTEtn0FaTjYN6AuJc7HkekEm0GPm4d4Kmz6hsa6Wq1/fdeS3n N+rVnBnbsD2TfbDD/kOEgC8IRYwSLkNitfv2m1lh8XPkm78UUHShxU1CDpSVz+Pfs86g Ja5lMT0rlEqvzvcxXUpIM3ZDG0WQtwMF4jw8n9ToWnXBA4cd/EcuGrJLy/8ztnf10e/Z 95KWgykfWuqORURMWppYMk6X058ghUwd4FFSU/Sr9+jnXc+RwdhYlesUaAbs2R0S08P2 D03w== X-Gm-Message-State: AOJu0YwOOrjKVeo54WkAoHOGTSBK082VM8aCCeHY+pVWyz+dVSsNpTB+ f6n256SgFgRSn9xDlQxx7w0bqKp2IsjVqOwdoYDmMbJL X-Google-Smtp-Source: AGHT+IFJqDus1ErJ47Ks1dzxdaDU7jQxxowFzuFDbViJBcu+ece1+ti7xFdfC/tWn8qv7LtWwOyYuD1hx3YJzdJm6r8= X-Received: by 2002:a4a:6b4a:0:b0:590:2b6d:a862 with SMTP id h10-20020a4a6b4a000000b005902b6da862mr1494940oof.15.1704694658760; Sun, 07 Jan 2024 22:17:38 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a8a:1591:0:b0:512:5dfe:4685 with HTTP; Sun, 7 Jan 2024 22:17:38 -0800 (PST) In-Reply-To: References: From: "David G. Johnston" Date: Sun, 7 Jan 2024 23:17:38 -0700 Message-ID: Subject: Re: alter table add x wrong error position To: jian he Cc: PostgreSQL-development Content-Type: multipart/alternative; boundary="000000000000960353060e69276a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000960353060e69276a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sunday, January 7, 2024, jian he 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=E2=80=99s finding =E2=80=9C=E2=80=A6 add column_name data_type column_co= nstraint=E2=80=9D 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. --000000000000960353060e69276a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sunday, January 7, 2024, jian he <jian.universality@gmail.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:=C2=A0 syntax error at or near "("
LINE 1: alter table atacc2 add constraints x unique (test, a, b);

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^
ADD either following with the optional keyword "COLUMN" or
"CONSTRAINT"=C2=A0 as the doc.
so I should expect the '^' point at "constraints"?

It=E2=80=99s finding =E2=80=9C=E2=80=A6 ad= d column_name data_type column_constraint=E2=80=9D then dies at the parenth= esis.=C2=A0 So indeed the care t should be pointing where it probably is, a= t the parenthesis that the error is referring to.

= David J.

--000000000000960353060e69276a--