lib / pq

Pure Go Postgres driver for database/sql
https://pkg.go.dev/github.com/lib/pq
MIT License
9.13k stars 913 forks source link

pq: CREATE INDEX CONCURRENTLY cannot be executed from a function or multi-command string #820

Open kamal-github opened 5 years ago

kamal-github commented 5 years ago

I am trying to run the migration, which has tables and indexes(also some are unique and concurrent) creation SQL statement in a single SQL file, but getting the below error.

(details: pq: CREATE INDEX CONCURRENTLY cannot be executed from a function or multi-command string)

rowland commented 5 years ago

I have my own schema migration utility and I too noticed that Postgres wouldn't allow me to Exec multiple CREATE INDEX CONCURRENTLY. I'm hesitant to suggest that Exec support multiple transactions in a single call, unless there's a clear standard and precedence, less the law of unintended consequences strike. Probably best to split the logic into multiple transactions at the application level.

RoiGlinik commented 5 months ago

Is there any solution for that?

sheregeda commented 2 months ago

Any updates?