Lee Wu
2004-06-18 22:51:27 UTC
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!
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!