OK, I am CC'ing Peter. I know he suspected a protocol issue, and
perhaps this will help him.
Thanks.
> > > I have seen this claim a number of times. What exactly is the problem?
> > > Is it unsafe to use large objects at all?
> >
> > Glad you brought this up. It was on the TODO list since 1.*, but I have
> > never read a report of a problem with it. Peter Mount is working on a
>
> Bruce:
>
> a few weeks ago, I wrote a message here saying that large objects are in fact
> broken, and produced the code that caused problems. Here is a copy of that
> mesasge:
>
> Sender: owner-pgsql-questions@hub.org
> Precedence: bulk
> Status: RO
>
> Okay. Ive got an image repository that im trying to set up using large objects
> to store the images in postgresql 6.2.1.
>
> I have written a little C program to do the work, and am having problems. I
> can get the large object to import, but the program runs into serious problems
> after that. Here is the main piece of the code:
>
> /* create the lobj */
> sprintf(buf, "/tmp/%s", cgi_val(cgi, "image"));
> printf("IMPORTING FILE: %s<P>", buf);
> fileid = lo_import(conn, buf);
>
> printf("File Id is %d", fileid);
>
>
> sprintf(buf, "INSERT INTO foo VALUES ('%s', %d)", cgi_val(cgi, "comment"),
> fileid);
> printf("Executing Query : %s<P>", buf);
>
> res = PQexec(conn, buf);
> if(PQresultStatus(res) != PGRES_COMMAND_OK) {
> printf("Database Error: %s", PQerrorMessage(conn));
> }
>
>
> The output produced looks like the lo_import() call worked (a id number is
> returned), but the second query runs into problenms. For example:
>
> Here is some output:
>
> IMPORTING FILE: /tmp/10-225341.jpg
>
> File Id is 18209Executing Query : INSERT INTO foo VALUES ('Testing', 18209)
>
> Database Error: unknown protocol character 'V' read from backend. (The protocol
> character is the first character the backend sends in
> response to a query it receives).
>
> this is a CGI program, and the http user has all access to table "foo" in the
> database. The postgres.log file also spits out this:
> NOTICE:LockRelease: locktable lookup failed, no lock
> -------------------------------------------------------------
>
>
> Bruce:
>
> Do you see a problem with the code that I missed, or are the large objects
> interface functions broken in 6.2.1?
>
> Regards,
> Mike
>
- --
Bruce Momjian
maillist@candle.pha.pa.us
------------------------------