please help me recover from duplicate key in unique index

Поиск
Список
Период
Сортировка
От Charles Martin
Тема please help me recover from duplicate key in unique index
Дата
Msg-id 20000104232841.13281.qmail@web3207.mail.yahoo.com
обсуждение исходный текст
Ответы Re: [GENERAL] please help me recover from duplicate key in unique index  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-general
Please help me recover our database from what I think
is a duplicate key in unique index problem.

We have a table of the following form:

    create table foo (id serial primary key, x
integer)

in our code we had, outside of any BEGIN/COMMIT block:

    insert into foo (x) values (...)

Without the transaction block, I believe we have had
duplicate keys inserted.  I've fixed the bug in the
code, but now I need to fix the database!

When I try to vacuum, I get this:

> vacuum;
NOTICE:  Rel sessions: TID 5/2: OID IS INVALID.
TUPGONE 1.
NOTICE:  Rel sessions: TID 5/6: OID IS INVALID.
TUPGONE 1.
NOTICE:  Rel sessions: TID 13/2: OID IS INVALID.
TUPGONE 1.
NOTICE:  Rel sessions: TID 13/6: OID IS INVALID.
TUPGONE 1.
ERROR:  Cannot insert a duplicate key into a unique
index

When I try to dump it out (to manually repair it), I
get this:

$ pg_dump gtmd000103 > gtmd.1
pqWait() -- connection not open
PQendcopy: resetting connection
SQL query to dump the contents of Table 'content' did
not execute correctly.  After we read all the table
contents from the backend, PQendcopy() failed.
Explanation from backend: 'pqWait() -- connection not
open
'.
The query was: 'COPY "content" TO stdout;
'.

Can anybody help me?  I am desperate.  Thanks.

Charles

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://messenger.yahoo.com

В списке pgsql-general по дате отправления:

Предыдущее
От: Jim Mercer
Дата:
Сообщение: backend grows during cursor/select/fetch (memory leak?)
Следующее
От: Charles Martin
Дата:
Сообщение: please help: system info