Strange constraint problem With PostgreSQL 8.3.1
От | ries van Twisk |
---|---|
Тема | Strange constraint problem With PostgreSQL 8.3.1 |
Дата | |
Msg-id | E82C0669-39BC-45F4-AC6E-04DA40F6CB0D@rvt.dds.nl обсуждение исходный текст |
Список | pgsql-novice |
hey All, I if a problem that apparently I can insert a record into my table with a constrain while in fact the reference doesn't exist: This is my query to test : SELECT * FROM acc_ops.tbl_part_status WHERE part_num NOT IN (SELECT part_num FROM acc_mkt.tbl_part_numbers) So the above means (in wording) find me all records where part_num is not found in acc_mkt.tbl_part_numbers (all fields do have a NOT NULL constraint). The above SQL returns me 2 records. On the table acc_ops.tbl_part_status I have the following constrain added: CONSTRAINT fk_tbl_part_status_2 FOREIGN KEY (part_num) REFERENCES acc_mkt.tbl_part_numbers (part_num) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION I am a bit puzzled by this, or I must be blind, would the above observations not contradict with eachother? Currently I am not be-able to make a test case because data is loaded from JasperETL from aCSV file, so I cannot pin-point it to a single item or reproduce it by hand. Any idea on what might be going on? Ries
В списке pgsql-novice по дате отправления: