I’m trying to update a Postgres database to set a boolean but I’m getting the following error
No operator matches the given name and argument type(s). You may need
to add explicit type casts.
I’ve cut down the table description to show it’s structure.
Column | Type | Modifiers
--------------------+-----------------------------+-----------
archived | boolean |
The column in the db is currently empty so I have no others to use as a comparison.
I’ve tried the following:
UPDATE table_name SET archived=TRUE WHERE id=52;
UPDATE table_name SET archived='t' WHERE id=52;
UPDATE table_name SET archived='1' WHERE id=52;
UPDATE table_name SET archived='t'::boolean WHERE id=52;
Neither of these have worked.
How do I cast my UPDATE to a boolean?
UPDATE: full error message
play_mercury=# UPDATE opportunities SET archived=TRUE WHERE id=(52,55,35,17,36,22,7,2,27,15,10,9,13,5,34,40,30,23,21,8,26,18,3,42,25,20,41,28,19,14,39,44,16,24,4,33,54,47,29,38,64);
ERROR: operator does not exist: bigint = record
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
The problem is in the
WHERE id=(52,55,...)Use:
WHERE id IN (52,55,...)