-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PostgreSQL 14.7, 11.19 incompatibility "CREATE INDEX CONCURRENTLY cannot be executed within a pipeline" #10
Comments
It seems there is a workaround for the issue, like following: create index concurrently if not exists idx_exchange_rate_from_currency_id
on ref_exchange_rate (from_currency_id)
;
create index concurrently if not exists idx_exchange_rate_to_currency_id
on ref_exchange_rate (to_currency_id)
;
... The issue is that according to a comment in npgsql repo npgsql/npgsql#462 (comment) driver executes in pipeline mode if DbCommand text contains semicolons. So, if each of the commands affected by the problem will be fully separated, they won't execute in pipeline and won't cause PostgreSQL protection firing. |
@mjauernig I think the workaround is acceptable as a makeshift and is really worth documenting, however ultimately the splitting algorythm in PostgresqlConnectionManager is wrong, and needs to be fixed. I looked at two implementations of the splitting algorythm: in Grate and in Npgsql. Thought Npgsql might expose it as public methods for reuse, but no, it is in internals. I think the easiest way forward would be to borrow splitting algorythm from Npgsql's SqlQueryParser. I could do a PR, however I am on Mac and I do not have proper infrastructure for unit tests. Would you accept a PR with only PostgreSQL tests passing? |
@shokurov |
@mjauernig all right, PR is in review. I could not repro BDD style tests, my tests are plain xUnit. If BDD style is mandatory, please give me an example with |
Thanks @shokurov for the contribution. I will merge it into the v6 release in the next few weeks. At the moments no BDD test is required. |
@droyad I see there is a commotion on separating providers. What is the plan on open PRs? Is the separation planned to happen after a stable release or is it a part of the release changes? |
We are transferring open PRs over the appropriate repo as we action them. If you could resubmit against that repo, that would be very helpful. With the split we can rev and major version independently for just the PostgreSQL provider and we don't need to wait until all the other ducks are in the row. |
Environment
Description
After upgrade of PostgreSQL to the latest minor versions: 14.7 and 11.19 (we support and test on these two branches 14 & 11) any migration with "CREATE INDEX CONCURRENTLY" failing with:
Migration example:
Table affected (minimal example to reproduce):
Steps To Reproduce
Create SQL migration, like in the example above, using clean PostgreSQL docker image (
postgres:14.7-bullseye
,postgres:11.19-bullseye
).Actual Behavior
Exception in migration log. See above.
Expected/Desired Behavior
Execution without exception.
Additional Context
Downgrading to 14.6, 11.18 respectively fixes the issue, and we used it as makeshift workaround.
Similar issue has been reported in Luquibase#3806 which also mentions that version 15.7 is also affected.
Also see PostgreSQL expert answer here.
The text was updated successfully, but these errors were encountered: