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.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to