BUG #4674: Unable to open lob

Lists: pgsql-bugs
From: "Yuichi Tanaka" <yuichi_tanaka(at)cybozu(dot)co(dot)jp>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4674: Unable to open lob
Date: 2009-02-24 07:27:24
Message-ID: 200902240727.n1O7ROn5097468@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4674
Logged by: Yuichi Tanaka
Email address: yuichi_tanaka(at)cybozu(dot)co(dot)jp
PostgreSQL version: 8.3.6
Operating system: Linux
Description: Unable to open lob
Details:

I wrote the code like below:

// open lob
if( (pgsql_lofd1 = lo_open(pgsql, oid, pgsql_mode)) == -1 ) {
printf("error: first lo_open\n");
}

// send query asynchronously
PQsendQuery(pgsql, "INSERT INTO bar (name) VALUES ('aaa');" );

// open lob
if( (pgsql_lofd2 = lo_open(pgsql, oid+1, pgsql_mode)) == -1 ) {
printf("error: second lo_open\n");
}

This program displays "error: second lo_open".
Is this a bug or correct behavior?


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Yuichi Tanaka" <yuichi_tanaka(at)cybozu(dot)co(dot)jp>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4674: Unable to open lob
Date: 2009-02-24 14:44:17
Message-ID: 8105.1235486657@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"Yuichi Tanaka" <yuichi_tanaka(at)cybozu(dot)co(dot)jp> writes:
> This program displays "error: second lo_open".

Where did you get the oid value from? What makes you think that one
more than that oid is also a large object?

regards, tom lane


From: 田中 裕一 <yuichi_tanaka(at)cybozu(dot)co(dot)jp>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4674: Unable to open lob
Date: 2009-02-26 04:25:21
Message-ID: 0_50158700_1235622321.14198.cbgrn@enoch.corp.cybozu.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

I'm sorry, that code is a test code, and oid value is written directly in the code.
I'm sure there are large objects whose id is oid and oid+1.

In fact, if I get rid of PQsendQuery statement, I can open the two large
objects because that code displays nothing.

In my survey, if I execute PQsendQuery between two lo_open,
the latter lo_open returns -1.
And this situation continues until the connection is disconnected.

Best regards.

Tom Lane wrote:
> "Yuichi Tanaka" <yuichi_tanaka(at)cybozu(dot)co(dot)jp> writes:
> > This program displays "error: second lo_open".
>
> Where did you get the oid value from? What makes you think that one
> more than that oid is also a large object?
>
> regards, tom lane

----
Yuichi Tanaka (yuichi_tanaka(at)cybozu(dot)co(dot)jp)