yesodweb / yesodweb/persistent
persistent should support schema-qualified table names
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
My particular problem involves PostgreSQL and schema-qualified table names:
CREATE TABLE acme.groups (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL
);
CREATE TABLE acme.widgets (
id SERIAL PRIMARY KEY,
"group" INT NOT NULL REFERENCES acme.groups(id),
name TEXT NOT NULL
);
However, this won't do what I want:
mkPersist sqlSettings [persist|
Widget sql=acme.widgets
group GroupId
name Text
deriving Show
Group sql=acme.groups
name Text
deriving Show
|]
because "acme.widgets" is quoted as a single identifier, which Postgres treats as a single identifier, rather than a schema-qualified name.
Because my database uses schema-qualified names for everything, it looks like I can't use persistent with it. This issue is related to pull request #82, where someone wanted a similar feature to access nested MongoDB objects, where the schema was already defined.
The easy fix would be to update each backend's escape function to not escape ., but this would be technically incorrect (in PostgreSQL, a quoted identifier may include "." in its name). The harder fix would be to support nested labels.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing each backend's escape function and the related design in pull request #82. Determine how schema-qualified names can be represented without treating dots inside quoted identifiers as separators; done means persistent can use acme.widgets and acme.groups correctly with PostgreSQL while preserving literal dots in identifiers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, postgresql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100