Re: ALTER TABLE validate foreign key dependency problem

2020-07-13 Thread David Rowley
On Mon, 13 Jul 2020 at 08:13, Simon Riggs wrote: > > On Sun, 12 Jul 2020 at 05:51, David Rowley wrote: > >> >> > I also considered that we could just delay all foreign key validations >> > until phase 3, but I ended up just doing then only when a rewrite is >> > pending. >> >> I still wonder if i

Re: ALTER TABLE validate foreign key dependency problem

2020-07-12 Thread Simon Riggs
On Sun, 12 Jul 2020 at 05:51, David Rowley wrote: > > I also considered that we could just delay all foreign key validations > > until phase 3, but I ended up just doing then only when a rewrite is > > pending. > > I still wonder if it's best to delay the validation of the foreign key > regardle

Re: ALTER TABLE validate foreign key dependency problem

2020-07-11 Thread David Rowley
On Thu, 9 Jul 2020 at 15:54, David Rowley wrote: > I think the fix is just to delay the foreign key validation when > there's a rewrite pending until the rewrite is complete. I looked over this again and only slightly reworded a comment. The problem exists as far back as 9.5 so I've attached 3 p

ALTER TABLE validate foreign key dependency problem

2020-07-08 Thread David Rowley
Hi, I had an ALTER TABLE dependency problem reported to me. Here's a simplified version of it: CREATE TABLE t (a INT, PRIMARY KEY(a)); ALTER TABLE t ADD CONSTRAINT t_fkey FOREIGN KEY (a) REFERENCES t(a) NOT VALID; ALTER TABLE t VALIDATE CONSTRAINT t_fkey, ALTER a TYPE BIGINT; Which results in: