Skip to content
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

Testing without a live DB connection? #217

Open
saurabhnanda opened this issue Jun 13, 2017 · 2 comments
Open

Testing without a live DB connection? #217

saurabhnanda opened this issue Jun 13, 2017 · 2 comments

Comments

@saurabhnanda
Copy link

Related to tomjaguarpaw/haskell-opaleye#308

Most of the runtime errors with PG-Simple are related to incorrect DB (de)serialisation code. Is it possible to run the FromField, ToField, FromRow, ToRow converter functions with a set of string/bytestring obtained from a file, without involving the DB?

@lpsmith
Copy link
Owner

lpsmith commented Jun 14, 2017

That is a good question. Unfortunately, there is not really a way to do this at the present time.

One possibility would be to use libpq to construct Result's that could then be used to test the (de)serializers, but the result construction functions are not currently available in the postgresql-libpq binding.

The other possibility that comes to my mind is refactoring the {To,From}{Field,Row} implementation, but I cannot say I am overly excited about that right now. The interface does need a breaking overhaul, but this alone cannot justify that. And maintaining the interace while not introducing too much additional overhead seems tricky.

@creichert
Copy link

@saurabhnanda This isn't a solution to your problem but if your queries use [sql| |] quasi-quoters you can at check the syntax of the query using https://github.com/joncfoo/postgresql-simple-query-validator. I generally use that in combination with manually written serialize/deserialize calls to the query.

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

No branches or pull requests

3 participants