Re: [BUGS] General Bug Report: Large Object Example testlo fails - Mailing list pgsql-bugs

From Tom Lane
Subject Re: [BUGS] General Bug Report: Large Object Example testlo fails
Date
Msg-id 6134.932048565@sss.pgh.pa.us
Whole thread Raw
In response to General Bug Report: Large Object Example testlo fails  (Unprivileged user <nobody>)
List pgsql-bugs
Mika.Saari@nokia.com writes:
> libpq++ Large Object Example testlo fails in PostgreSQL 6.5 but NOT
> in 6.4.2. The ERROR message is
>   Connection to database 'template1' failed.
>   PQsendQuery() -- There is no connection to the backend.

> 14. ./testlo template1 testlo test 0

It looks like testlo is now set up so that the first argument is a
conninfo string, not just a database name.  So, something like

    ./testlo dbname=template1 testlo test 0

should work.

If the other method is still being recommended in some documentation
somewhere, then we need to fix that --- where did you find the info?

Also, I'd say that the error message here is pretty awful.  Looks like
that's because PQconnectdb's original message about bogus syntax for a
conninfo string (which might actually have been helpful) is being
overwritten when the PgLargeObject constructors plow ahead with trying
to create and open a large object.  They should not do that if the
underlying connection constructor failed :-(.

Finally, I don't particularly like the fact that both constructors for
PgLargeObject insist on creating and opening a LO.  If you're going to
import() or export() you do not need an LO filehandle; and if you're
going to import() then the constructor-created LO is wasted, making
for a semi-permanent diskspace leak.

Perhaps the best way to design PgLargeObject is to make both creation
and opening "lazy", happening only at the first call that requires 'em.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Unprivileged user
Date:
Subject: General Bug Report: Large Object Example testlo fails
Next
From: Wayne Piekarski
Date:
Subject: Backend dies creating plpgsql procedures (with reproducible example!)