"Nigel J. Andrews" <nandrews@investsystems.co.uk> writes:
> I wonder if anyone has any comments on this [psuedo] code:
> new loid := SELECT lo_creat(131072 + 262144);
> UPDATE pg_largeobject SET
> data = (SELECT data
> FROM pg_largeobject
> WHERE loid = <source loid> AND pageno = 0)
> WHERE loid = <new loid> AND pageno = 0;
> INSERT INTO pg_largeobject
> (loid, pageno, data)
> (SELECT <new loid>, pageno, data
> FROM pg_largeobject
> WHERE loid = <source loid> AND pageno > 0
> );
I believe this will work, but it requires superuser privileges to
scribble on pg_largeobject directly. Probably would be better to go
through the gruntwork of creating a fully supported lo_copy() operation.
regards, tom lane