From: | ries van Twisk <pg(at)rvt(dot)dds(dot)nl> |
---|---|
To: | PostgreSQL List - Novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | Strange constraint problem With PostgreSQL 8.3.1 |
Date: | 2009-01-12 14:27:10 |
Message-ID: | E82C0669-39BC-45F4-AC6E-04DA40F6CB0D@rvt.dds.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Wright, George | 2009-01-14 14:41:33 | function transaction scope question |
Previous Message | Wright, George | 2009-01-12 14:18:28 | debugging plpgsql functions |