-
Notifications
You must be signed in to change notification settings - Fork 56
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
Adding Encoding/Decoding for custom PG Types #103
Comments
There's no encoder for composite types, it's Postgres to blame. There are work-arounds however. For more info and the reasoning see the following issues: |
Thanks, I've managed to get the SQL to work but the corresponding Hasql fails. My code is below, I've more or less followed the method used in #65.
Unfortunately this fails when I attempt to execute the actual query. Looks like something about the serialisation for cast and unnest is not correct.
The corresponding SQL works correctly because of the
Is this do-able with Hasql 1.x? I noticed a different API in #25 should I be using the dev branch instead? |
Yes.
Why do you cast your every parameter There's too many things happening in your code. To determine the issue I suggest to gradually move from a simpler case step by step. Start by first ensuring that you've implemented the innermost select correctly. |
Thanks, I simplified as suggested and it turns out that using unknown in place of a money type means that the server was unable to find the right function or cast the array correctly. Changed it to a numeric type and function resolution occurs correctly. |
I'm trying to define a clean interface into a set of PG tables and using functions/stored procs using custom PG types. I've defined the following:
How can I define an encoding and decoding for the custom types? I've looked through the source for the existing mappings but am not clear how to actually map to a
ROW(a,as,am,d) :: ledger.posting_entry
from haskell.I can change the interface into the function as a last resort.
The text was updated successfully, but these errors were encountered: