General Bug Report: Large Object Example testlo fails
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Mika Saari
Your email address : Mika.Saari@nokia.com
Category : runtime: front-end: C++
Severity : non-critical
Summary: Large Object Example testlo fails
System Configuration
--------------------
Operating System : Linux 2.2.5 ELF
PostgreSQL version : 6.5
Compiler used : egcs-2.91.66
Hardware:
---------
PII, 128MB RAM, 18Gb DISK
Linux <mymachine> 2.2.5-15 #1 Mon Apr 19 23:00:46 EDT 1999 unknown
RedHat 6.0
Versions of other tools:
------------------------
GNU Make version 3.77
Flex Version 2.5.4
--------------------------------------------------------------------------
Problem Description:
--------------------
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.
--------------------------------------------------------------------------
Test Case:
----------
1. tar xvzf postgresql-6.5.tar.gz
2. cd postgresql-6.5
3. cd src
4. ./configure --prefix=/opt/postgresql-v6.5
5. make; make install
6. ldconfig
7. chown -R postgres /opt/postgresql-v6.5 /opt/postgresql-6.5
8. su - postgres
9. initdb
10.postmaster -i
11.cd /opt/postgresql-6.5/src/interfaces/libpq++/examples
12.vi Makefile
HEADERDIR=/opt/postgresql-v6.5/include
LIBPQDIR=/opt/postgresql-v6.5/lib
LDFALGS+= -L$(LIBPQDIR) -lcrypt -lpq++
13. make
14. ./testlo template1 testlo test 0
This command has been tested with all parameters world
can handle ;)
All other example files libtestpq0 - libtestpq6 works
without any problem.
--------------------------------------------------------------------------
Solution:
---------
--------------------------------------------------------------------------
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
Import Notes
Reply to msg id not found: YourmessageofThu15Jul1999035237-0400199907150752.DAA98227@hub.org | Resolved by subject fallback