sbdchd / squawk

🐘 linter for PostgreSQL, focused on migrations
https://squawkhq.com
GNU General Public License v3.0
541 stars 37 forks source link

new rule: concurrent index creation cannot be run in transaction #332

Closed chdsbd closed 5 months ago

chdsbd commented 6 months ago

If you attempt to run a concurrent index creation in a transaction, Postgres will error. We should warn about this:

begin;
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_foo_bar ON account (foo);

-- Query 1 ERROR at Line 1: : ERROR:  CREATE INDEX CONCURRENTLY cannot run inside a transaction block

based on #331