Thread: ERROR: duplicate key violates unique constraint "pg_class_oid_index"

ERROR: duplicate key violates unique constraint "pg_class_oid_index"

From
"borajetta"
Date:
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)

Re: ERROR: duplicate key violates unique constraint "pg_class_oid_index"

From
Tom Lane
Date:
"borajetta" <borajetta@hotmail.com> writes:
> I tried to cluster the isbn_table

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

Is this repeatable?  If so, could you get a debugger stack trace from
the point of the error?

Also, exactly which PG version are you using?

            regards, tom lane

Re: ERROR: duplicate key violates unique constraint "pg_class_oid_index"

From
"borajetta"
Date:
 I am using PG version 7.4.3.2.



----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "borajetta" <borajetta@hotmail.com>
Cc: <pgsql-general@postgresql.org>
Sent: Saturday, August 21, 2004 8:55 AM
Subject: Re: [GENERAL] ERROR: duplicate key violates unique constraint
"pg_class_oid_index"


> "borajetta" <borajetta@hotmail.com> writes:
> > I tried to cluster the isbn_table
>
> >  cluster isbn_index_code on isbn_table;
> > ERROR:  duplicate key violates unique constraint "pg_class_oid_index"
>
> Is this repeatable?  If so, could you get a debugger stack trace from
> the point of the error?
>
> Also, exactly which PG version are you using?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>
>