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
);
It does seem to work but I wouldn't like to swear it's safe, hence this
posting.
I was originally looking for a newoid() function to use, then thought about
wrapping my own seeing as there wasn't one but then spotted there were some lo_
functions available. Therefore, lo_creat() I'm really just using to grab a new
oid for the new large object.
--
Nigel J. Andrews