Skip to content
This repository has been archived by the owner on Jun 28, 2018. It is now read-only.

Advisory unlock error with Postgres #296

Open
Teddy-Schmitz opened this issue Oct 19, 2017 · 2 comments · May be fixed by #303
Open

Advisory unlock error with Postgres #296

Teddy-Schmitz opened this issue Oct 19, 2017 · 2 comments · May be fixed by #303

Comments

@Teddy-Schmitz
Copy link

Hi,

First, thanks for this library its been very useful to us. I believe we have found a bug in how the postgres driver does the unlock. It doesn't actually check if the unlock was successful. Postgres doesn't return an error, just true or false and this is not checked in the code.

query := `SELECT pg_advisory_unlock($1)`

This should be scanned into a bool just as the lock code does and checked. Also since we don't have the same session it will never actually be successful since the unlock needs to be called within the same session. The only reason this isn't a bigger issue is because I imagine most people close the connection after migration which will automatically release the lock.

It looks like this can be fixed in go1.9 based on your comment in #274 .

I'm happy to make a PR to add the check for if the unlock was successful or not but I'm unsure if you would actually want to abort the migration at that point since it was already successful, and hopefully it will be fixed whenever #274 is fixed as well.

Thanks!

@mattes
Copy link
Owner

mattes commented Oct 20, 2017

I as well think #274 is blocking this. Thanks for finding this.

@Teddy-Schmitz
Copy link
Author

You're welcome, any thoughts on adding the Go 1.9 feature to migrate? Maybe behind a compilation flag to support older versions?

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

Successfully merging a pull request may close this issue.

2 participants