Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx
919.297.1078


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux