Skip to main content

SKY-Q507 · Quality, structure and performance

Unsupported concurrent PostgreSQL index drop

Medium

The script uses DROP INDEX CONCURRENTLY with more than one index or with CASCADE. PostgreSQL accepts a single index with the default RESTRICT behavior.

Languages
PostgreSQL
Quality gate
listed, not counted by the gate (full and diff scans). This PostgreSQL finding is report-only.
Finding type
review
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

A migration that groups indexes or requests automatic dependency removal fails at this statement.

What Skylos flags

migration.sql · SQLReported on line 1
DROP INDEX CONCURRENTLY orders_id, orders_status;
pyproject.toml · TOML
[tool.skylos.sql]dialect = "postgresql"

What Skylos leaves alone

migration.sql · SQL
DROP INDEX CONCURRENTLY orders_id;DROP INDEX CONCURRENTLY orders_status;

pyproject.toml: same as in the flagged example.

Why Skylos leaves it alone

Handle each index separately. Inspect its dependencies before planning any removal.

How Skylos decides

  1. Skylos checks the index list and drop behavior on the parsed command.
  2. It reports one finding when both restrictions apply.

How to fix it

Handle each index separately. Inspect its dependencies before planning any removal.

migration.sql · SQL · the fix, against the flagged file
Removed: DROP INDEX CONCURRENTLY orders_id, orders_status;Added: DROP INDEX CONCURRENTLY orders_id;Added: DROP INDEX CONCURRENTLY orders_status;

When it can be wrong

  • Ordinary DROP INDEX follows different rules. Database ownership and live dependencies also affect execution.

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.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.