To reproduce this, place an acts_as_taggable in an ActiveRecord that has a varchar as the primary key, then call Model.tagged_with("whatever").count
SELECT COUNT() FROM "features" INNER JOIN "taggings" "feature_taggings_23f3fd7" ON "feature_taggings_23f3fd7"."taggable_id" = "features"."key" AND "feature_taggings_23f3fd7"."taggable_type" = 'Feature' AND "feature_taggings_23f3fd7"."tag_id" IN (SELECT "tags"."id" FROM "tags" WHERE LOWER("tags"."name") ILIKE 'portal' ESCAPE '!')
ActiveRecord::StatementInvalid: PG::UndefinedFunction: ERROR: operator does not exist: integer = character varying
LINE 1: ...3fd7" ON "feature_taggings_23f3fd7"."taggable_id" = "feature...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT COUNT() FROM "features" INNER JOIN "taggings" "feature_taggings_23f3fd7" ON "feature_taggings_23f3fd7"."taggable_id" = "features"."key" AND "feature_taggings_23f3fd7"."taggable_type" = 'Feature' AND "feature_taggings_23f3fd7"."tag_id" IN (SELECT "tags"."id" FROM "tags" WHERE LOWER("tags"."name") ILIKE 'portal' ESCAPE '!')
To reproduce this, place an acts_as_taggable in an ActiveRecord that has a varchar as the primary key, then call Model.tagged_with("whatever").count
SELECT COUNT() FROM "features" INNER JOIN "taggings" "feature_taggings_23f3fd7" ON "feature_taggings_23f3fd7"."taggable_id" = "features"."key" AND "feature_taggings_23f3fd7"."taggable_type" = 'Feature' AND "feature_taggings_23f3fd7"."tag_id" IN (SELECT "tags"."id" FROM "tags" WHERE LOWER("tags"."name") ILIKE 'portal' ESCAPE '!') ActiveRecord::StatementInvalid: PG::UndefinedFunction: ERROR: operator does not exist: integer = character varying LINE 1: ...3fd7" ON "feature_taggings_23f3fd7"."taggable_id" = "feature... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. : SELECT COUNT() FROM "features" INNER JOIN "taggings" "feature_taggings_23f3fd7" ON "feature_taggings_23f3fd7"."taggable_id" = "features"."key" AND "feature_taggings_23f3fd7"."taggable_type" = 'Feature' AND "feature_taggings_23f3fd7"."tag_id" IN (SELECT "tags"."id" FROM "tags" WHERE LOWER("tags"."name") ILIKE 'portal' ESCAPE '!')