SDB601[critical]Transactions
Statement can't run inside a transaction
CONCURRENTLY and similar statements fail inside a transaction block.
Why it's risky in PostgreSQL
CREATE INDEX CONCURRENTLY, REINDEX CONCURRENTLY and VACUUM refuse to run in a transaction. Many migration tools wrap each file in one by default.
What triggers it, and the safer way
BEGIN;
CREATE INDEX CONCURRENTLY orders_created_idx ON orders (created_at);
COMMIT;-- Put the statement alone in a file your migration tool runs without a transaction.
CREATE INDEX CONCURRENTLY orders_created_idx ON orders (created_at);Suppress it when you're sure
Put this comment on the line before the statement. The reason is required and shows in the report.
-- shadowdb:allow SDB601 <why this is safe here>Applies to PostgreSQL 14, 15, 16, 17.