Reputation: 1195
I added the jsonb field in which I want to store the ID.
Next, I need to implement a "search" of records by the contents of this field.
Everywhere, including the documentation (link), I saw this operator - @>
. But I didn't manage to use it:
User.where.not("migration_ids @> ?", 1)
ActiveRecord::StatementInvalid (PG::UndefinedFunction: ERROR: operator does not exist: jsonb @> integer)
LINE 1: ...s".* FROM "users" WHERE NOT (migration_ids @> 1) LIMI...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Tell me, please, how to do it right?
Upvotes: 0
Views: 52