[CDBI] Postgresql 8.0 woes

Rick Welykochy rick at praxis.com.au
Fri May 5 20:33:00 BST 2006

I am setting up a new server which is based on another that
was running Postgresql 7.0.2. The sysadmin has installed Pg 8
on the new server.

I have imported the database I was using on the old server,
and now when I fire up CDBI, I see the following error:

   DBD::Pg::st execute failed: ERROR:
   more than one row returned by a subquery used as an expression
   [for Statement "SELECT indkey FROM pg_catalog.pg_index
   WHERE indisprimary=true AND indrelid=(
   SELECT oid FROM pg_catalog.pg_class
   WHERE relname = ?)
   " with ParamValues: 1='tables'] at /usr/local/share/perl/5.8.7/Ima/DBI.pm line 715.
   Compilation failed in require at ./t.pl line 4.
   BEGIN failed--compilation aborted at ./t.pl line 4.

Google finds this: http://www.spanner.org/lists/cdbi/2005/07/13/190f87ff.html

   Ah, that's the thing--that's not my query, Class::DBI::Pg is issuing
   that.  I've been told that a patch has been sent to the cdbi::Pg
   author--here's hoping it goes in :-)

   On Tue, 2005-07-12 at 17:34 -0500, Jay Strauss wrote:
   > Actually that is the problem, your subselect is returning more than 1
   > row but you are using an "="
   >  > indrelid=(
   >  > SELECT oid FROM pg_catalog.pg_class
   >  > WHERE relname = ?)
   > make it look like:
   > indrelid in (
   > SELECT oid FROM pg_catalog.pg_class
   > WHERE relname = ?)

. . . . . . . . . . . . . . . . .

I've upgraded to the latest CDBI::Pg. Same problem, doesn't look like the above-mentioned
patch has been implemented.

Actually, I don't see how changing indrelid=(..) to indrelid in (..) would
work. The correct oid might not be the first one returned.

Anyway, if anyone else has run into this problem please let me know.

I don't require Pg 8.0, so perhaps if we backoff to 7.0.2 the problem
will just go away.


Rick Welykochy || Praxis Services

The next best thing to knowing something is knowing where to find it.
      -- Samuel Johnson

More information about the ClassDBI mailing list