bad data with Foreign Key constraint
От | Lee Wu |
---|---|
Тема | bad data with Foreign Key constraint |
Дата | |
Msg-id | ECAB83AA52BCC043A0E24BBC00001024111265@mxhq-exch.corp.mxlogic.com обсуждение исходный текст |
Ответы |
Re: bad data with Foreign Key constraint
|
Список | pgsql-admin |
Hi All,
I have found that there are some foreign keys in our detail tables while there are not primary keys in master tables.
Yes, we have FK constraints on detail tables.
I could not think how it can happen. PG (7.3.2) does not have “disable constraint” like Oracle, does it?
Sample data from PG:
select rid from c except select rid from r;
rid
-------------
7686396
7688003
7906141
7974816
8033807
(5 rows)
\d c
Table "public.c"
Column | Type | Modifiers
---------------+--------------------------+----------------------------------------------------
cid | integer | not null default nextval('c_id_seq'::text)
rid | integer | not null
others...|
Indexes: c_pkey primary key btree (cid),
c_rid_idx btree (rid)
Foreign Key constraints: $1 FOREIGN KEY (rid) REFERENCES r(rid) ON UPDATE NO ACTION ON DELETE CASCADE
Thank for your help!
В списке pgsql-admin по дате отправления: