Skip to content
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

[Evolve Exception] CREATE INDEX CONCURRENTLY cannot be executed within a pipeline Sql query: -- evolve-tx-off #310

Open
santosh-kumar-metikoti opened this issue Oct 6, 2023 · 0 comments

Comments

@santosh-kumar-metikoti
Copy link

santosh-kumar-metikoti commented Oct 6, 2023

Environment

  • Npgsql version: 4.1.3.1
  • Evolve: 2.4.0
  • Database: PostgreSQL: 11.20
  • OS: Windows 11 x86 bit
  • .NET version: 5.0

Description

  • When executing a migration file without a transaction (by using --evolve-tx-off), creating multiple indexes concurrently in a single migration file is throwing a evolve exception in postgresql 11.20

  • It is not throwing any error when

    Exception message:

    Evolve.EvolveException: 'Error executing script: V202307111148__create_index_testresult.sql after 3 ms. 25001: CREATE INDEX CONCURRENTLY cannot be executed within a pipeline Sql query: -- evolve-tx-off  CREATE UNIQUE INDEX CONCURRENTLY test_testresult ON public.test(testresult);  C... 25001: CREATE INDEX CONCURRENTLY cannot be executed within a pipeline'
  • This exception didn’t occur in PostgreSQL 10, but this is found in later on some major versions like PostgreSQL 11,12,13

Steps to Reproduce

  • Create a table named test with the below syntax in a PostgreSQL 11.02 database

    create table test(
    	id serial not null,
    	testname varchar(32) not null,
    	testresult varchar(32) not null,
    
    	constraint test_pkey primary key(id)
    )
  • After creating the table test, create a versioned migration file with contents as shown below

    -- evolve-tx-off
    
    CREATE UNIQUE INDEX CONCURRENTLY test_testname ON public.test(testname);
    
    CREATE UNIQUE INDEX CONCURRENTLY test_testresult ON public.test(testresult);
  • Connect to this database from the application and run it.

  • You will come across the exception as mentioned above.

Actual Project

Expected/Desired Behavior

  • Two indexes should be created without any exception

Actual Behavior

  • Getting Evolve exception

    Evolve.EvolveException: 'Error executing script: V202307111148__create_index_testresult.sql after 3 ms. 25001: CREATE INDEX CONCURRENTLY cannot be executed within a pipeline Sql query: -- evolve-tx-off  CREATE UNIQUE INDEX CONCURRENTLY test_testresult ON public.test(testresult);  C... 25001: CREATE INDEX CONCURRENTLY cannot be executed within a pipeline'

Additional Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant