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

Fix usage of array types in DSL #103

Merged
merged 5 commits into from
May 28, 2024
Merged

Fix usage of array types in DSL #103

merged 5 commits into from
May 28, 2024

Conversation

oyvindberg
Copy link
Owner

  • Add test to discover which array types work well with DSL for now.
  • Results were somewhat disappointing, because the mechanism for forwarding postgres type names for arrays is not good enough (relies on sql type name from type class instance)
  • It's hard to fix this optimally, because we can't change library typeclasses
  • An issue we need more wrapper types to solve is that in postgres, arrays of varchar and text are not comparable!

This PR goes some way towards fixing the most dire things, but it was a mistake to reuse sql type names from the typeclass instances of the database libraries.

The fix for anorm is a hack, and the only path foward is really to not use ParameterMetaData at all.

Done by hacking `arrayParameterMetaData`

- Add test to discover which array types work well with DSL for now.
- Results were somewhat disappointing, because the mechanism for forwarding postgres type names for arrays is not good enough.
- It's hard to fix this optimally, because we can't change library typeclasses
- Add a hack to `arrayParameterMetaData` which computes `ParameterMetadata` for array types. this makes the test mostly green.
- An issue we need more wrapper types to solve is that in postgres, arrays of `varchar` and `text` are not comparable!
- replace `ParameterMetaData` (ported from anorm) with a correctly defined `PGType` type class
@oyvindberg oyvindberg merged commit ccc188f into main May 28, 2024
7 checks passed
@oyvindberg oyvindberg deleted the improve-arrays branch May 28, 2024 22:47
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

Successfully merging this pull request may close these issues.

1 participant