yesodweb / yesodweb/persistent
Different encoding behavior for PersistDbSpecific with persistent-postgresql and persistent-mysql
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
What is the discrepancy?
persistent-mysql and persistent-postgresql encode PersistDbSpecific differently.
persistent-mysql uses Plain:
However, persistent-postgresql uses Escape (effectively, treating it as a string-like value):
When was this introduced?
The behavior for PostgreSQL changed with 9287943c1dd4ca0c9822a715c057f4fb2ab6888e.
Why is this a problem?
With the current behavior it is not possible to encode something like point '(2.0,0)' for PostgreSQL.
(I would also be very surprised if the example given in the docs for PersistDbSpecific is still anywhere close working; but I haven't tried that specifically.)
How to address this?
I'm not sure how to best address this. Altering how PersistDbSpecific is encoded would be a breaking change that isn't detected by the type checker. One solution might be to remove PersistDbSpecific and add two new constructors:
PersistDbSpecificEscape, which usesEscape(current behavior ofpersistent-postgresql)PersistDbSpecificPlain, which usesPlain(current behavior ofpersistent-mysql)
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
Compare the PersistDbSpecific handling in persistent-mysql/Database/Persist/MySQL.hs and persistent-postgresql/Database/Persist/Postgresql.hs, including the referenced PostgreSQL change 9287943c1dd4ca0c9822a715c057f4fb2ab6888e. First establish the intended distinction between Plain and Escape, then determine an agreed backward-compatible API and verify that the documented PostgreSQL example works with the resulting behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100