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

search_path is not restored after migration #737

Closed
mapoulin opened this issue Apr 25, 2014 · 4 comments
Closed

search_path is not restored after migration #737

mapoulin opened this issue Apr 25, 2014 · 4 comments

Comments

@mapoulin
Copy link

@mapoulin mapoulin commented Apr 25, 2014

Hi Axel,

We are using Flyway 2.3 with PostgreSQL 8.0.2, although the issue should apply to other versions of PostgreSQL as well. Basically, Flyways checkout a Connection from our pooled DataSource with the search_path defined as "$user, public" but then checks it in after migration with a search_path defined as "public, X, $user, public", where X is the schema we wanted to migrate.

This is problematic for us when we want to migrate another schema, say Y, and Flyway checkout that same Connection AFTER the schema X as been dropped. It then tries to append Y to the search_path resulting in a PSQLException stating that the schema X does not exist anymore. The migration of schema Y then fails.

I believe this behavior comes from the fix for #374

Thanks !
Marc-André

@axelfontaine axelfontaine added this to the Flyway 3.1 milestone Apr 25, 2014
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Apr 25, 2014

Good point! Flyway should definitely be cleaner here and restore things as it found them.

Accepted.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Nov 24, 2014

As a workaround for now, you can do this in an afterMigrate callback.

@axelfontaine axelfontaine added this to the Flyway 3.2 milestone Nov 24, 2014
@axelfontaine axelfontaine removed this from the Flyway 3.1 milestone Nov 24, 2014
@axelfontaine axelfontaine added this to the Flyway 4.0 milestone Mar 5, 2015
@axelfontaine axelfontaine removed this from the Flyway 3.2 milestone Mar 5, 2015
@lbourdages
Copy link

@lbourdages lbourdages commented Jul 23, 2015

Hi,

I have had the same problem as mapoulin described and stumbled on this issue. I'm using a callback to clean up the search_path while waiting for 4.0.

I just wanted to let you know that it also (perhaps obviously) happens with Redshift (as the RedshiftDBSupport is virtually the same as PostgresDLSupport).

Thanks,

Louis

axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Oct 27, 2015
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Oct 27, 2015

This has now been fixed.

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

Successfully merging a pull request may close this issue.

None yet
3 participants