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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for citext[] arrays. #972

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Adding support for citext[] arrays. #972

wants to merge 1 commit into from

Conversation

jwoertink
Copy link
Member

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)

UserQuery.new.tags.includes("aNyCasE")

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 and citext when it comes to arrays 馃槤 It can do WHERE email = 'SuPpOr@blah.COM' but it can't do WHERE tags @> array['Crystal']. You have to cast the array like array['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.

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.

Support Array of citext citext[] column
1 participant