Skip to content

adding-foreign-key-constraint shouldn't warn if the constraint and tables are created in the same transaction #973

@lupuchard

Description

@lupuchard

require-concurrent-index-creation won't trigger if the index and table are created in the same transaction, since the table will be empty and unused at the time the lock is needed. I think foreign key constraint creation should have similar behavior.

This triggers the warning currently:

BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS dbo.table1 (id bigint);
CREATE TABLE IF NOT EXISTS dbo.table2 (table1_id bigint references dbo.table1(id));
END TRANSACTION;

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions