CI Text should be usable with toTsVector
In postgresql, the following works fine:
CREATE EXTENSION citext;
CREATE TABLE examples ( example citext PRIMARY KEY);
INSERT INTO examples(example) VALUES ('my cool example'), ('my even cooler example'), ('my lame example');
SELECT * FROM examples WHERE to_tsvector(examples.example) @@ to_tsquery('cool');
However, in Beam, you can't use toTsVector on columns of type CI Text.
I see two (relatively) easy way of solving this:
- Add an instance of
IsSqlExpressionStringTypeforCI Text - Create a new class, named something like
IsValidTsquerySource, addTextandCI Textto it, and then use that as the constraint fortoTsvectorinstead
I can implement either (I think), but wanted to ask before writing any code.
IsSqlExpressionStringType is now BeamSqlBackendIsString, but otherwise I believe approach (1) is better. I'm not very familiar with citext, it does support all normal string functions and not just comparisons, right? The Postgres docs aren't super clear on this.
I believe so, although I'm not 100% certain. I suppose that would probably be something to ask the postgres mailing lists?
I will note that I've used citext extensively on both personal and professional projects and (from my recollection) have never encountered any place where it behaves differently from text other than the obvious case-insensitivity.
Perfect, adding the BeamSqlBackendIsString instance should be the way to go then.