Reputation: 4419
I have a table with a column named _id
of which the type is uuid
. I cast the type of _id
from uuid
to varchar
, in order to select the records as follows:
SELECT "_id" FROM "records" WHERE "_id"::"varchar" LIKE '%1010%';
and it works well.
_id
--------------------------------------
9a7a36d0-1010-11e5-a475-33082a4698d6
(1 row)
I use sequelize as ORM for operation postgres. how to build the query condition in sequelize?
Upvotes: 13
Views: 20588
Reputation: 4419
I write the query condition as follows, and it works well. Is there any better solution?
{where: ['_id::"varchar" like ?', '%1010%']},
Upvotes: 16