I'm trying to alter a bytea
column to have type oid
and still retain the values.
I have tried using queries like:
ALTER TABLE mytable ADD COLUMN mycol_tmp oid;
UPDATE mytable SET mycol_tmp = CAST(mycol as oid);
ALTER TABLE mytable DROP COLUMN mycol;
ALTER TABLE mytable RENAME mycol_tmp TO mycol;
But that just gives me the error:
ERROR: cannot cast type bytea to oid
Is there any way to achieve what I want?