unable to drop a constraint

Поиск
Список
Период
Сортировка
От Enrico Sirola
Тема unable to drop a constraint
Дата
Msg-id A2CF4BF9-4FC3-4A38-97C7-403D360EA512@gmail.com
обсуждение исходный текст
Ответы Re: unable to drop a constraint  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: unable to drop a constraint  (Michael Glaesemann <michael.glaesemann@myyearbook.com>)
Список pgsql-general
Hi,

I'm using postgresql version 8.3.1

I have two tables, one has a field with a foreign key pointing to the
primary key of another table. When I to drop the first table, I get
the following error:

test=# drop table user;
ERROR:  "customer_pkey" is an index

test=# select * from pg_constraint where conname like '%user%';
       conname       | connamespace | contype | condeferrable |
condeferred | conrelid | contypid | confrelid | confupdtype |
confdeltype | confmatchtype | conkey | confkey | conpfeqop | conppeqop
| conffeqop | conbin | consrc
--------------------+--------------+---------+---------------
+-------------+----------+----------+-----------+-------------
+-------------+---------------+--------+---------+-----------
+-----------+-----------+--------+--------
  user_pkey      |       137354 | p       | f             |
f           |   137475 |        0 |         0 |
|             |               | {1}    |         |
|           |           |        |
  user_role_fkey |       137354 | f       | f             |
f           |   137475 |        0 |    137463 | a           |
a           | u             | {2}    | {1}     | {93}      | {93}
| {93}      |        |
(2 rows)

so, I try to drop the foreign key constraint:

test=# alter table user DROP CONSTRAINT user_role_fkey;
ERROR:  "customer_pkey" is an index

quite frustrated, I try to drop the pk index on the customer table:

test=# drop index customer_pkey ;
ERROR:  cannot drop index customer_pkey because constraint
customer_pkey on table customer requires it
HINT:  You can drop constraint customer_pkey on table customer instead.

test=# ALTER TABLE customer drop CONSTRAINT customer_pkey;
ERROR:  "customer_pkey" is an index

I'm quite cunfused... Any idea?
Thanks,
e.


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

Предыдущее
От: Klint Gore
Дата:
Сообщение: Re: Referential integrity vulnerability in 8.3.3
Следующее
От: Viktor Rosenfeld
Дата:
Сообщение: Re: UPDATE runs slow in a transaction