Skip site navigation (1) Skip section navigation (2)

ERROR: duplicate key violates unique constraint "pg_class_oid_index"

From: "borajetta" <borajetta(at)hotmail(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: ERROR: duplicate key violates unique constraint "pg_class_oid_index"
Date: 2004-08-20 18:23:19
Message-ID: BAY17-DAV19aSORH9HW000008c0@hotmail.com (view raw or flat)
Thread:
Lists: pgsql-general
ERROR:  duplicate key violates unique constraint "pg_class_oid_index"

I found a post earlier but wanted to post up my info as the other persons did not look like the same type of error:

I tried to cluster the isbn_table

 cluster isbn_index_code on isbn_table;
ERROR:  duplicate key violates unique constraint "pg_class_oid_index"

The table looks like this 

Table "public.isbn_table"
 Column  |  Type  | Modifiers 
---------+--------+-----------
 item_id | bigint | not null
 date    | date   | 
 code    | isbn   | 
Indexes:
    "isbn_pkey_item_id" primary key, btree (item_id)
    "isbn_index_code" btree (code)
    "isbn_index_date" btree (date)
    "isbn_index_date_code" btree (date, code)
Triggers:
    checkisbn BEFORE INSERT OR UPDATE ON isbn_table FOR EACH ROW EXECUTE PROCEDURE isbntrigger()

Here is the vacuum verbose of pg_class

INFO:  vacuuming "pg_catalog.pg_class"
INFO:  index "pg_class_oid_index" now contains 698 row versions in 7 pages
DETAIL:  168 index row versions were removed.
0 index pages have been deleted, 0 are currently reusable.
CPU 0.00s/0.00u sec elapsed 0.00 sec.
INFO:  index "pg_class_relname_nsp_index" now contains 698 row versions in 23 pages
DETAIL:  168 index row versions were removed.
0 index pages have been deleted, 0 are currently reusable.
CPU 0.00s/0.00u sec elapsed 0.00 sec.
INFO:  "pg_class": removed 170 row versions in 10 pages
DETAIL:  CPU 0.00s/0.00u sec elapsed 0.00 sec.
INFO:  "pg_class": found 170 removable, 698 nonremovable row versions in 143 pages
DETAIL:  0 dead row versions cannot be removed yet.
There were 5717 unused item pointers.
0 pages are entirely empty.
CPU 0.00s/0.00u sec elapsed 0.00 sec.
VACUUM




select * from pg_class where relname='isbn_table';

  relname   | relnamespace |  reltype   | relowner | relam | relfilenode | relpages |  reltuples  | reltoastrelid | reltoastidxid | relhasindex | relisshared | relkind | relnatts | relchecks | reltriggers | relukeys | relfkeys | relrefs | relhasoids | relhaspkey | relhasrules | relhassubclass | relacl 
------------+--------------+------------+----------+-------+-------------+----------+-------------+---------------+---------------+-------------+-------------+---------+----------+-----------+-------------+----------+----------+---------+------------+------------+-------------+----------------+--------
 isbn_table |         2200 | 4280007913 |        1 |     0 |  4281669172 |    13950 | 2.03181e+06 |             0 |             0 | t           | f           | r       |        3 |         0 |           1 |        0 |        0 |       0 | f          | t          | f           | f              | 
(1 row)


select oid,ctid,cmax,xmax,cmin,xmin,* from pg_class
where relname='isbn_table';

    oid     |   ctid   | cmax | xmax | cmin |   xmin   |  relname   | relnamespace |  reltype   | relowner | relam | relfilenode | relpages |  reltuples  | reltoastrelid | reltoastidxid | relhasindex | relisshared | relkind | relnatts | relchecks | reltriggers | relukeys | relfkeys | relrefs | relhasoids | relhaspkey | relhasrules | relhassubclass | relacl 
------------+----------+------+------+------+----------+------------+--------------+------------+----------+-------+-------------+----------+-------------+---------------+---------------+-------------+-------------+---------+----------+-----------+-------------+----------+----------+---------+------------+------------+-------------+----------------+--------
 4280007912 | (132,16) |    3 |    0 |    0 | 46981456 | isbn_table |         2200 | 4280007913 |        1 |     0 |  4281669172 |    13950 | 2.03181e+06 |             0 |             0 | t           | f           | r       |        3 |         0 |           1 |        0 |        0 |       0 | f          | t          | f           | f              | 
(1 row)

Responses

pgsql-general by date

Next:From: Tom LaneDate: 2004-08-20 18:24:19
Subject: Re: How to setup default value "0000-00-00" for "date"
Previous:From: Bruce MomjianDate: 2004-08-20 18:14:04
Subject: Re: How to setup default value "0000-00-00" for "date"

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group