SKY-Q506 · Quality, structure and performance
Concurrent PostgreSQL index command inside a transaction
The script opens an explicit transaction and requests a concurrent index build or drop before it ends. PostgreSQL rejects that command.
- Languages
- PostgreSQL
- Quality gate
- listed, not counted by the gate (full and diff scans). This PostgreSQL finding is report-only.
- Finding type
- review
Why it matters
The migration stops before it can build or remove the index. A migration runner can also supply an outer transaction.
What Skylos flags
BEGIN;CREATE INDEX CONCURRENTLY orders_id ON orders(id);COMMIT;[tool.skylos.sql]dialect = "postgresql"What Skylos leaves alone
CREATE INDEX CONCURRENTLY orders_id ON orders(id);Why Skylos leaves it alone
Run the concurrent command outside the explicit transaction. Check whether the migration runner wraps it in another transaction.
How Skylos decides
- Skylos follows BEGIN, START TRANSACTION, COMMIT, ROLLBACK and transaction chaining within one session.
- Savepoints keep the outer transaction open.
How to fix it
Run the concurrent command outside the explicit transaction. Check whether the migration runner wraps it in another transaction.
Removed: BEGIN;CREATE INDEX CONCURRENTLY orders_id ON orders(id);Removed: COMMIT;When it can be wrong
- A transaction opened by a migration runner is outside the scanned SQL.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Review the statement in the context of its migration.