On Fri, Jan 23, 2009 at 12:08:02PM +0000, Howard Cole wrote:
> Is there some nice SQL I can use to convert a BYTEA field into large
> objects?
You may be able to do something like:
SELECT oid, lowrite(lo_open(oid, 131072), (SELECT byteafield FROM tbl WHERE x)
FROM lo_create(NULL) o(oid);
You could turn this around to maybe do:
UPDATE tbl t SET newoid = (
SELECT oid FROM (
SELECT oid, lowrite(lo_open(oid, 131072), t.byteafield)
FROM lo_create(0) o(oid)) x);
--
Sam http://samason.me.uk/