Re: BUG #16088: Multiple foreigh keys created on "ALTER TABLE" command - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16088: Multiple foreigh keys created on "ALTER TABLE" command
Date
Msg-id 23525.1572363425@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16088: Multiple foreigh keys created on "ALTER TABLE" command  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> If you run this command multiple times:

> ALTER TABLE myschema.mytable ADD IF NOT EXISTS mycolumn uuid REFERENCES
> myschema.mytable2(userid);

> It adds the column once, but adds a duplicate FOREIGN KEY each time.

Yeah, this is a well known problem :-(.  The IF NOT EXISTS conditionalizes
addition of the column, but not the quasi-independent addition of the
foreign key constraint.  There's work afoot to make this behave more
intuitively, but it won't land before v13 at the earliest.

            regards, tom lane



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16088: Multiple foreigh keys created on "ALTER TABLE" command
Next
From: Euler Taveira
Date:
Subject: Re: BUG #16086: Cannot connect using psql, however I can connectusing pgadmin