Skip to content

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

2 participants