Constraint and Index with same name? (chicken and egg probelm)

Поиск
Список
Период
Сортировка
От David Brain
Тема Constraint and Index with same name? (chicken and egg probelm)
Дата
Msg-id 46091B8A.10801@bandwidth.com
обсуждение исходный текст
Ответы Re: Constraint and Index with same name? (chicken and egg probelm)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,

This could well be a recurrence of this issue:

http://archives.postgresql.org/pgsql-general/2007-01/msg01801.php

for which there doesn't seem to have been a resolution.

I am running:

PostgreSQL 8.1.5 on x86_64-pc-linux-gnu, compiled by GCC
x86_64-pc-linux-gnu-gcc (GCC) 4.1.1 (Gentoo 4.1.1-r1)

I seem to have wound up with what I can only assume is a constraint and
index sharing the same name:

e.g.

cdr=# drop index cdrimportsession_pkey;
ERROR:  cannot drop index cdrimportsession_pkey because constraint
cdrimportsession_pkey on table cdrimportsession requires it
HINT:  You may drop constraint cdrimportsession_pkey on table
cdrimportsession instead.


cdr=# alter table cdrimportsession drop constraint cdrimportsession_pkey;
NOTICE:  constraint fk_cdrsummary_cdrimportsession on table cdrsummary
depends on index cdrimportsession_pkey
ERROR:  "cdrimportsession_pkey" is an index


So the schema here is fairly straightforward - I have two tables,
cdrimportsession and cdrsummary which has a FK into cdrimportsession.

I discovered this issue while trying to remove the FK constraint from
the cdrsummary table - it complained about cdrimportsession_pkey being
an index.

I can send the output of pgdump -s on this db if this would be helpful.

While it would be great to figure out _why_ this happened it would be
even better to figure out a way of getting around it (I've already tried
  renaming the cdrimportsession_pkey index - it renames, but I then have
same issue just with different constraint/index names) as the tables
involved are pretty huge and a dump/restore isn't really an option.

Thanks,

David.

--
David Brain - bandwidth.com
dbrain@bandwidth.com
919.297.1078

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

Предыдущее
От: Jesse Cleary
Дата:
Сообщение: Re: Could not create relation: File exists error
Следующее
От: Kenneth Downs
Дата:
Сообщение: Re: cutting out the middleperl