Strange constraint problem With PostgreSQL 8.3.1 - Mailing list pgsql-novice

From ries van Twisk
Subject Strange constraint problem With PostgreSQL 8.3.1
Date
Msg-id E82C0669-39BC-45F4-AC6E-04DA40F6CB0D@rvt.dds.nl
Whole thread Raw
List 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 by date:

Previous
From: "Wright, George"
Date:
Subject: debugging plpgsql functions
Next
From: "Wright, George"
Date:
Subject: function transaction scope question