Skip to content

PG: operator does not exist: uuid ~~* unknown #709

Closed

Description

Hello, I have an UUID column as ID column. When I do:

Campaign.search(id_cont: 'abc').result

I get this error:

HINT:  No operator matches the given name and argument type(s).
You might need to add explicit type casts.
SELECT  "campaigns".* FROM "campaigns" WHERE "campaigns"."pro_user_id" = $1
AND "campaigns"."aasm_state" = 'drafted'
AND ("campaigns"."id" ILIKE NULL) 
ORDER BY "campaigns"."created_at" DESC
LIMIT 25
OFFSET 0

PG::UndefinedFunction: ERROR:  operator does not exist: uuid ~~* unknown
LINE 1: ...s"."aasm_state" = 'drafted' AND ("campaigns"."id" ILIKE NULL...

Any idea? Thanks.

Activity

  1. jonatack commented on Aug 8, 2016

    @jonatack
    Contributor

    Hello @zenati, to help people help you, could you provide a gist to reproduce your issue?

    Please see CONTRIBUTING.md file for more information and a bug report template.

  2. jonatack commented on Aug 31, 2016

    @jonatack
    Contributor

    Stalled. Closing for now.

  3. istvanfazakas commented on Sep 6, 2016

    @istvanfazakas

    same issue here. the IDs in the tables are not of type Integer, they are UUIDs. When passing the ids to ransacker, it tries to find the objects with 'ILIKE' method, instead of simple 'IN'

  4. kkarski82 commented on Apr 27, 2017

    @kkarski82

    Here's a solution:

    module RansackUUIDHelper
      extend ActiveSupport::Concern
    
      included do
        ransacker :id do
          Arel.sql("\"#{table_name}\".\"id\"::varchar")
        end
      end
    end

    All you need to do then is include RansackUUIDHelper in your model.

  5. self-assigned this
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions