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

check for permissions before starting migration #390

Closed
snoyberg opened this Issue Apr 28, 2015 · 0 comments

Comments

Projects
None yet
4 participants
@snoyberg
Member

snoyberg commented Apr 28, 2015

See this thread for details: https://groups.google.com/d/msg/yesodweb/txpHU5Xi_-E/h_do1trsLsQJ

Goal: run a query along the following lines to ensure we have permissions to view all information on a schema before starting a migration to ensure more usable error messages:

SELECT grantee, privilege_type FROM information_schema.role_table_grants WHERE table_name = ? AND grantee = CURRENT_USER;

@gregwebs gregwebs added the Postgres label May 12, 2015

@gregwebs gregwebs changed the title from PostgreSQL: check for permissions before starting migration to check for permissions before starting migration May 12, 2015

@MaxGabriel MaxGabriel added the Newcomer label Aug 19, 2015

psibi added a commit to psibi/persistent that referenced this issue Nov 9, 2015

Change the query for checking existence of Table
The old query doesn't work in the scenario where the table is present
but under the ownership of a different user. This query fixes it.
Also it improves the error message related to issue #390.

Instead of an error message like this:

SqlError {sqlState = "42P07", sqlExecStatus = FatalError, sqlErrorMsg =
"relation \"person\" already exists", sqlErrorDetail = "",
sqlErrorHint = ""}

You get this:

SqlError {sqlState = "42501", sqlExecStatus = FatalError, sqlErrorMsg =
"must be owner of relation person", sqlErrorDetail = "", sqlErrorHint =
""}

psibi added a commit to psibi/persistent that referenced this issue Mar 20, 2016

@psibi psibi closed this Mar 22, 2016

@snoyberg snoyberg removed the in progress label Mar 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment