Thread

  1. Re: [BUGS] General Bug Report: Large Object Example testlo fails

    Tom Lane <tgl@sss.pgh.pa.us> — 1999-07-15T14:22:45Z

    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