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.96) (envelope-from ) id 1vcRv2-006ewB-1n for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Jan 2026 17:29:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vcRu1-00Fd8a-1p for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Jan 2026 17:28:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vcRu1-00Fd8S-0u for pgsql-hackers@lists.postgresql.org; Sun, 04 Jan 2026 17:28:30 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vcRu0-004AB6-27 for pgsql-hackers@postgresql.org; Sun, 04 Jan 2026 17:28:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 604HSPnx884406; Sun, 4 Jan 2026 12:28:25 -0500 From: Tom Lane To: jian he cc: Kirill Reshke , Amul Sul , PostgreSQL-development Subject: Re: Error position support for ComputeIndexAttrs In-reply-to: References: Comments: In-reply-to jian he message dated "Sun, 04 Jan 2026 12:19:25 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <884404.1767547705.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 04 Jan 2026 12:28:25 -0500 Message-ID: <884405.1767547705@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk jian he writes: > This will not work for ``ALTER TABLE t ADD CONSTRAINT c UNIQUE (ii);``. > In this case, gram.y produces a single Constraint node, and Constraint n= ode > contain only one location field. However, a unique location is required = for each > IndexElem node. Yeah, the actual problem is that the column name(s) in Constraint are just a list of String nodes without per-name locations. transformIndexConstraint throws some errors using constraint->location that really ought to point at an individual column name, so there's room for improvement there, as seen in this example from the regression tests: -- UNIQUE with a range column/PERIOD that isn't there: CREATE TABLE temporal_rng3 ( id INTEGER, CONSTRAINT temporal_rng3_uq UNIQUE (id, valid_at WITHOUT OVERLAPS) ); ERROR: column "valid_at" named in key does not exist LINE 3: CONSTRAINT temporal_rng3_uq UNIQUE (id, valid_at WITHOUT O... ^ But this seems like material for a separate patch. regards, tom lane