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

More information in decoding errors #142

Open
guaraqe opened this issue Nov 30, 2021 · 3 comments
Open

More information in decoding errors #142

guaraqe opened this issue Nov 30, 2021 · 3 comments

Comments

@guaraqe
Copy link
Contributor

guaraqe commented Nov 30, 2021

When there is a decoding error, it is common to have something like:

ResultError (RowError 0 UnexpectedNull)

which shows the error, but lacks details, which can be difficult to debug, especially in very large queries. Would it be possible to return the full row that is supposed to be decoded, as well as the index in the row where the failure occurred? It seems that decoding happens in Haskell, so that should be possible.

@nikita-volkov
Copy link
Owner

Yeah, something like that is possible. Actually this issue can be divided into three:

  1. Extend RowError with the index of the failed column. Not very hard.
  2. Extend ResultError with meta info about the structure of the result. This involves processing column OIDs. OID is how Postgres identifies the types. Must be noted that there are some complications involved in regards to composite and array types. So, this one is complicated.
  3. Match the user-supplied decoders against that meta info. See Consider implementing an OID-based decoder compatibility check #97

I don't plan to develop these features myself, since my effort is focused on a native Postgres driver project now. https://twitter.com/NikitaYVolkov/status/1452985041366175750. It's likely that I'll address these issues there. As for addressing this in Hasql, PRs are welcome!.

@guaraqe
Copy link
Contributor Author

guaraqe commented Nov 30, 2021

The first one would be very useful already. If you give me some pointers on where to start, I think I can free some time to do it.

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

2 participants