> Is there an easy way to copy a large object to a new one, having a new
> OID and it's content independent from the original ?
So my current solution would be:
CREATE OR REPLACE FUNCTION copy_blob(p_blobId OID)
RETURNS OID AS '
DECLARE
v_NewOID BIGINT;
BEGIN
SELECT lo_create(0) INTO v_NewOID;
DELETE FROM pg_largeobject WHERE loid = v_NewOID;
INSERT INTO pg_largeobject (loid, pageno, data)
SELECT v_NewOID, pageno, data
FROM pg_largeobject
WHERE loid = p_blobId;
RETURN v_NewOID;
END;
' LANGUAGE plpgsql;
I would still be grateful if anybody knows a better solution using plain
SQL/plpgsql...
Cheers,
Csaba.