PostgreSQL: from OID to Bytea
We have decided to move from OID s in our PostgreSQL 9.0 database and use bytea columns instead. I'm trying to copy the data from one column to the other, but I can't figure out the right query. This is the closest I've gotten to: update user as thistable set pkcs_as_bytea = (select array_agg(mylargeobject.data) from (select * from pg_largeobject where loid = thistable.pkcs12_as_oid order by pageno) as mylargeobject) where thistable.pkcs12 is not null And that gives me the following error message: ERROR: column "pkcs_as_bytea" is of type bytea but expression is of type bytea[] What would be