lo_open problems
lo_open problems
От:
James Leigh <james.leigh@ottawa.com>
Дата:
I am using some large object, but lo_open always returns -1. I don't
know why.
Here is a code snipet (compiled with g++ for C++).
/*
* create the large object
*/
Oid lobjId = lo_creat(conn, INV_READ | INV_WRITE);// works
if (lobjId == 0){
fprintf(stderr, "can't create large object\n");
return 0;
}
int lobj_fd = lo_open(conn, lobjId, INV_WRITE);// == -1
if(lobj_fd < 0){
fprintf(stderr, "can't open large object (%d)\n", lobjId);
return 0;
}
lo_creat works and I can use psql with '\dl' to see the new lo created,
but lo_open returns '-1'. In what cases would lo_open fail after a
successfull lo_creat?
Running the provided sample program works, so lo support is there, but
in my large application I cannot open the lo.
any ideas?
james
Re: lo_open problems
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
James Leigh writes: > I am using some large object, but lo_open always returns -1. I don't > know why. Are you doing this inside a transaction block? regards, tom lane
Re: lo_open problems
От:
James Leigh <james.leigh@ottawa.com>
Дата:
Tthat was it, Thanks. I did not see that in the docs, it should be added. cheers, james On Mon, 2002-03-04 at 18:10, Tom Lane wrote: > James Leigh writes: > > I am using some large object, but lo_open always returns -1. I don't > > know why. > > Are you doing this inside a transaction block? > > regards, tom lane
Re: lo_open problems
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
James Leigh wrote:
> Tthat was it, Thanks. I did not see that in the docs, it should be
> added.
>
> cheers,
> james
>
>
> On Mon, 2002-03-04 at 18:10, Tom Lane wrote:
> > James Leigh writes:
> > > I am using some large object, but lo_open always returns -1. I don't
> > > know why.
> >
> > Are you doing this inside a transaction block?
> >
I see it in the docs. It is missing somewhere else?
All large object manipulation must take
place within an SQL transaction. This requirement is strictly
enforced as of PostgreSQL 6.5</>, though it has been an
implicit requirement in previous versions, resulting in
misbehavior if ignored.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026