I have a database column (running) which is of type (int2) in postgres. It has data in it. The data in this column is either a 1 or a 0.
I want to alter the column to boolean. The reason i am here is because the query below worked on 2 previous test db's I with no issue. I cannot figure out why it fails on this new database.
Some background information: We are migrating from Oracle to Postgres. The database has the orifice plugin.
I have tried casting, but that fails.
This is the original working query, which doesn't work on the new db:
ALTER TABLE system_status ALTER running TYPE bool USING CASE WHEN running = 0 THEN FALSE ELSE TRUE END;
ERROR:
Query execution failed
Reason:
SQL Error [42883]: ERROR: operator does not exist: boolean = integer
Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
runningalready is a boolean column. Btw: you could simplify your expression to... type bool using running = 1running = 0comparison cannot be done as the=operator for comparing boolean and intergers do not exist, which indicates that running is already a boolean