public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: jian he <[email protected]>
Cc: Kirill Reshke <[email protected]>
Cc: Amul Sul <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Error position support for ComputeIndexAttrs
Date: Sun, 04 Jan 2026 12:28:25 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CACJufxHv13cw9g-mM+skF4JrhAA4dULFvQctwvDpuOL4mwKoRA@mail.gmail.com>
References: <CACJufxH3OgXF1hrzGAaWyNtye2jHEmk9JbtrtGv-KJK6tsGo5w@mail.gmail.com>
<CAAJ_b95FOL6uEUb6p4=ho7Bj=HFBpzhRh5G0G2--YH9qHxt0rw@mail.gmail.com>
<CACJufxHQLuROz_1MjuvNSp+QgtLfNH_noiq18mZBhB8Mk01_=g@mail.gmail.com>
<CALdSSPjm8dB6ypEkivNMQp48U6YRv0VofX7KndS2Nq0DZO+OKg@mail.gmail.com>
<CACJufxHv13cw9g-mM+skF4JrhAA4dULFvQctwvDpuOL4mwKoRA@mail.gmail.com>
jian he <[email protected]> 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 node
> 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
view thread (3+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Error position support for ComputeIndexAttrs
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox