pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: jeremyevans0@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16589: Regression when using ADD UNIQUE+ADD FOREIGN KEY in same query in 13 beta
Date: Sat, 22 Aug 2020 12:37:27 -0400
Message-ID: <2206633.1598114247@sss.pgh.pa.us> (raw)
In-Reply-To: <16589-31c8d981ca503896@postgresql.org>
References: <16589-31c8d981ca503896@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> The following SQL worked as expected in previous PostgreSQL versions (at
> least 8.4-12):
>   CREATE TABLE "items" ("id" integer NOT NULL, "item_id" integer NOT
> NULL);
>   ALTER TABLE "items" ADD UNIQUE ("item_id", "id"), ADD FOREIGN KEY ("id",
> "item_id") REFERENCES "items"("item_id", "id");
> In PostgreSQL 13 beta 3, it results in an error: there is no unique
> constraint matching given keys for referenced table "items"

Yup, that's my fault; fix pushed.

> I'm not sure whether this is considered a bug.  It broke a couple tests for
> a database access library I maintain, but I could easily modify them if this
> isn't considered a bug.

Yeah, I think it's a bug, especially since the case used to work.
ALTER TABLE generally believes that it's smarter than you are about
the order in which the subcommands need to be executed; so it has
to hold up its end of the bargain.

			regards, tom lane





view thread (2+ messages)

Message-ID: <2206633.1598114247@sss.pgh.pa.us>
Permalink:  ../2206633.1598114247@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2206633.1598114247@sss.pgh.pa.us

 · 

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: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jeremyevans0@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16589: Regression when using ADD UNIQUE+ADD FOREIGN KEY in same query in 13 beta
  In-Reply-To: <2206633.1598114247@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox