Hasql.Encoders encodes composite types with UNKOWN instead of RECORD
Currently, the function composite builds an encoder with an OID of unknown. This means that trying to bind composite arrays does not work, with the following error:
ResultError (ServerError "42804" "binary data has array element type 705 (unknown) instead of expected 2249 (record)" Nothing Nothing Nothing)
I believe that this can be fixed by using the record OID instead.
You've correctly identified the problem. I am not sure that switching the type to record will help, but I will accept a PR, which proves that it works via tests.
In the long run I've been planning a solution that would look up the OID in the DB by name and cache it. Can't make promises how soon I'll get to it.
The solution is in master. Custom types are identifiable by name now. I'm prepping the next major release.
Hasql 1.10 contains the fix.