pg.ddx.io pgsql-bugs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
BUG #16088: Multiple foreigh keys created on "ALTER TABLE" command 2+ messages / 2 participants [nested] [flat]
* BUG #16088: Multiple foreigh keys created on "ALTER TABLE" command @ 2019-10-29 15:26 PG Bug reporting form <noreply@postgresql.org> 2019-10-29 15:37 ` Re: BUG #16088: Multiple foreigh keys created on "ALTER TABLE" command Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 2+ messages in thread From: PG Bug reporting form @ 2019-10-29 15:26 UTC (permalink / raw) To: pgsql-bugs@lists.postgresql.org; +Cc: jsturgeon@novetta.com The following bug has been logged on the website: Bug reference: 16088 Logged by: Jess Sturgeon Email address: jsturgeon@novetta.com PostgreSQL version: 12.0 Operating system: RHEL 7.7 Description: 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. I had over 59 keys while debugging my schema definition :) This happens in PG11.5 and PG12 for me, both on RHEL 7.7 ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #16088: Multiple foreigh keys created on "ALTER TABLE" command 2019-10-29 15:26 BUG #16088: Multiple foreigh keys created on "ALTER TABLE" command PG Bug reporting form <noreply@postgresql.org> @ 2019-10-29 15:37 ` Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2019-10-29 15:37 UTC (permalink / raw) To: jsturgeon@novetta.com; +Cc: pgsql-bugs@lists.postgresql.org 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 ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-10-29 15:37 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-10-29 15:26 BUG #16088: Multiple foreigh keys created on "ALTER TABLE" command PG Bug reporting form <noreply@postgresql.org> 2019-10-29 15:37 ` Tom Lane <tgl@sss.pgh.pa.us>
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