Getting rid of duplicate tables. - Mailing list pgsql-general

From Jared Carr
Subject Getting rid of duplicate tables.
Date
Msg-id 400C0674.2090007@89glass.com
Whole thread Raw
Responses Re: Getting rid of duplicate tables.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
First I wish I knew how this was caused but here is our problem.

Sometime in the recent past we got a duplicate table.  Here is the
result of a pg_dump with a pg_restore for just that table.

--
-- TOC entry 59 (OID 11462032)
-- Name: order_to_do; Type: TABLE; Schema: public; Owner: www
-- Data Pos: 0
--

CREATE TABLE order_to_do (
    order_id integer DEFAULT 0 NOT NULL,
    to_do_id text DEFAULT ''::text NOT NULL,
    date_time timestamp without time zone DEFAULT '0001-01-01 00:00:00'::timestamp without time zone NOT NULL,
    csr_id integer DEFAULT 0 NOT NULL,
    supplement text DEFAULT ''::text NOT NULL
);


--
-- TOC entry 60 (OID 11462032)
-- Name: order_to_do; Type: TABLE; Schema: public; Owner: www
-- Data Pos: 0
--

CREATE TABLE order_to_do (
    order_id integer DEFAULT 0 NOT NULL,
    to_do_id text DEFAULT ''::text NOT NULL,
    date_time timestamp without time zone DEFAULT '0001-01-01 00:00:00'::timestamp without time zone NOT NULL,
    csr_id integer DEFAULT 0 NOT NULL,
    supplement text DEFAULT ''::text NOT NULL
);

So somehow it appears that we managed to get an *exact* duplicate of the table well at least
a duplicate reference to the table somewhere important.

First of all how do we get rid of this "extra" table?

Note:
  live=# drop table order_to_do;
  ERROR: duplicate key violates unique constraint "pg_class_oid_index"

Secondly any ideas on how it got there in the first place?

Can this just happen? Or did someone here have to accidentally do something
to create it.

Sorry for not having any idea on what caused this, but thanks for any help you can
give.

Jared



pgsql-general by date:

Previous
From: "Mark Cave-Ayland"
Date:
Subject: Re: indexing with lower(...) -> queries are not optimised very well - Please Help
Next
From: Mental
Date:
Subject: Re: importing data