yesodweb / yesodweb/persistent

doesTableExist causes problems when there are tables with the same name and different owners (persistent-postgres)

Open
#576 5 comments 0 reactions 1 assignee View on GitHub

@psibi is already working on this.

Since Jun 15, 2016.

in progress Postgres
Dominant language
Haskell
Stars
486
Forks
306
PR merge metrics
No merged PRs in 30d

Description

I have to work with my uni's database where each user has access to his/her own tables only. I run into problem when I wanted to create table with the name someone already used. I am able to create it manually by psql, but specifying entity in persistent causes errors because doesTableExist finds those tables. That function is located in: persistent/persistent-postgresql/Database/Persist/Postgresql.hs

For example there is table:
tablename=my_table, tableowner=user1
I want to define model in yesod:
MyTable and I am user2, which should produce:
tablename=my_table, tableowner=user2.
Now doesTableExist would find my_table created by user1, that I have no access to and which should be ignored.
doesTableExist should use query that check if tableowner="databse user" that I have given in settings file.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.