Adding support for citext[] arrays. #972
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #970
This PR will add support for
citext[]
which is an array of case-insensitive strings. This would allow you to store an array of strings in a column, and query against it without worrying about the casing (e.g. tags)Currently putting this in WIP because Crystal PG doesn't have array decoder support for citext
Ref: will/crystal-pg#250
From what I can tell, when you add in the citext extension, that postgres server will assign citext a custom OID which means the OID may be different on every project, server, etc... Since CrystalPG can't just determine what the type is when using a StringDecoder, it ends up raising an exception.
My guess is once CrystalPG supports it, most of this code will "just work"... However, one tricky part is postgres doesn't seem to auto-cast between
text
andcitext
when it comes to arrays 😝 It can doWHERE email = '[email protected]'
but it can't doWHERE tags @> array['Crystal']
. You have to cast the array likearray['Crystal']::citext[]
. So if that doesn't auto happen through crystal PG, then we may need to make sure your column definition knows it's a citext somehow.