Searching on a text field does not work
snex opened this issue · 1 comments
snex commented
When searching on a text field, using the default conditions, I get the following error:
ActiveRecord::StatementInvalid (PG::UndefinedObject: ERROR: type "VARCHAR" does not exist
The full query being generated is:
SELECT
COUNT(*)
FROM
(
SELECT
DISTINCT "hand_histories"."id"
FROM
"hand_histories"
INNER JOIN "hands" ON "hands"."id" = "hand_histories"."hand_id"
INNER JOIN "positions" ON "positions"."id" = "hand_histories"."position_id"
INNER JOIN "bet_sizes" ON "bet_sizes"."id" = "hand_histories"."bet_size_id"
INNER JOIN "table_sizes" ON "table_sizes"."id" = "hand_histories"."table_size_id"
WHERE
CAST("hand_histories"."note" AS "VARCHAR") ILIKE '%man%'
) subquery_for_count
If I copy the query directly into psql console, I get the same error. If I remove the quote marks around "VARCHAR" then it works. These quote marks seem to be the problem.
snex commented
Issue appears to be caused by arel_extensions gem (https://github.com/Faveod/arel-extensions/).