Out of sync Primary Key Index

From: Dave Coventry <dgcoventry(at)gmail(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Out of sync Primary Key Index
Date: 2009-11-18 16:26:21
Message-ID: 4cba5adc0911180826h7f28a3a0mea1d1845fa2a4344@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have deleted a record from a table and am now getting errors:

INSERT INTO content_node_field (field_name, type, global_settings,
required, multiple, db_storage, module, db_columns, active, locked)
VALUES ('field_client_name', 'text',
'a:4:{s:15:"text_processing";s:0:"";s:10:"max_length";s:0:"";s:14:"allowed_values";s:0:"";s:18:"allowed_values_php";s:0:"";}',
0, 0, 1, 'text',
'a:1:{s:5:"value";a:5:{s:4:"type";s:4:"text";s:4:"size";s:3:"big";s:8:"not
null";b:0;s:8:"sortable";b:1;s:5:"views";b:1;}}', 1, 0);
ERROR: duplicate key value violates unique constraint "content_node_field_pkey"

My table is as follows:

\d content_node_field;
Table "public.content_node_field"
Column | Type | Modifiers
-----------------+------------------------+----------------------------------------
field_name | character varying(32) | not null default
''::character varying
type | character varying(127) | not null default
''::character varying
global_settings | text | not null
required | smallint | not null default 0
multiple | smallint | not null default 0
db_storage | smallint | not null default 1
module | character varying(127) | not null default
''::character varying
db_columns | text | not null
active | smallint | not null default 0
locked | smallint | not null default 0
Indexes:
"content_node_field_pkey" PRIMARY KEY, btree (field_name)

From googling I need to reset my Primary Key, but

reindex index content_node_field_pkey;
REINDEX

Doesn't make any difference (no error is returned)

Nor does
reindex table content_node_field;
REINDEX

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2009-11-18 16:32:40 Re: Out of sync Primary Key Index
Previous Message Tech 2010 2009-11-18 15:48:14 Re: vacuumdb: vacuuming of database "xy" failed: PANIC: corrupted item pointer: 19227