cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

sql: VALIDATE CONSTRAINT gets hung up when FK is added all in a single transaction.

Open tyler314 opened this issue 7 years ago • 1 comments

When a Foreign Key is added to a table, and you attempt to validate said constraint, it gets hung up and cannot complete the query. I observed that this only occurs if you CREATE TABLE and VALIDATE CONSTRAINT all in the same transaction.

To Reproduce Setup a cockroach cluster or demo, start a transaction, create two tables, add a FK to one of them, and validate the constraint. Example:

BEGIN; CREATE TABLE a ( x STRING NULL, CONSTRAINT "primary" PRIMARY KEY (x) ); CREATE TABLE b ( a_x STRING NULL, INDEX idx (a_x) ); ALTER TABLE b ADD CONSTRAINT fk_ref FOREIGN KEY (a_x) REFERENCES a (x); ALTER TABLE b VALIDATE CONSTRAINT fk_ref; ... Get's hung here ...

tyler314 avatar Jul 10 '19 20:07 tyler314

No longer repros.

jordanlewis avatar Jul 25 '21 21:07 jordanlewis