Re: lo_copy()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: lo_copy()
Date: 2003-04-01 15:15:27
Message-ID: 782.1049210127@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Nigel J. Andrews" <nandrews(at)investsystems(dot)co(dot)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

In response to

  • lo_copy() at 2003-04-01 07:29:56 from Nigel J. Andrews

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Razvan 2003-04-01 15:20:55 Re: How can I save/load all triggers/stored procedures from a file?
Previous Message Marc Drouin 2003-04-01 15:12:17 Trigger functions