sql: VALIDATE CONSTRAINT gets hung up when FK is added all in a single transaction.
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 ...
No longer repros.