Database corruption with duplicate tables.

From: George Woodring <george(dot)woodring(at)iglass(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Database corruption with duplicate tables.
Date: 2010-04-19 13:31:19
Message-ID: y2ycfbfcf161004190631g4cca8410wdc7e413f3dca37a9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have found that I have a database problem after receiving the
following error from pg_dump:

pg_dump: SQL command failed
pg_dump: Error message from server: ERROR:  more than one row returned
by a subquery used as an expression
pg_dump: The command was: SELECT tableoid, oid, typname, typnamespace,
(SELECT rolname FROM pg_catalog.pg_roles WHERE oid = typowner) as
rolname, typinput::oid as typinput, typoutput::oid as typoutput,
typelem, typrelid, CASE WHEN typrelid = 0 THEN ' '::"char" ELSE
(SELECT relkind FROM pg_class WHERE oid = typrelid) END as typrelkind,
typtype, typisdefined, typname[0] = '_' AND typelem != 0 AND (SELECT
typarray FROM pg_type te WHERE oid = pg_type.typelem) = oid AS isarray
FROM pg_type

Upon investigation I found that I have a table that is in the database twice

db=> select oid, relname from pg_class where oid IN (26770910,
26770918, 26770919);
oid | relname
----------+---------------------------------------
26770910 | availcpedata_20100410
26770918 | availcpedata_20100410_date_index
26770919 | availcpedata_20100410_pollgrpid_index
26770910 | availcpedata_20100410
(4 rows)

I was going to recreate the database by running "pg_dump -n public" to
get around the duplicate table, but I get the same pg_dump error
message.

Can anyone suggest a strategy for removing the table? I don't want to
start randomly deleting stuff from the catalogs.

Thanks,
Woody

--
iGLASS Networks
www.iglass.net

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karl Denninger 2010-04-19 13:39:42 Re: Problem with pg_compresslog'd archives
Previous Message Koichi Suzuki 2010-04-19 13:30:25 Re: Problem with pg_compresslog'd archives