All Forums Database
MNagat 7 posts Joined 03/06
03 Mar 2006
Compound FK allows nulls - is that normal behaviour?

Hello TeraData experts,I've been surprised with the following behaviour of TD. Please see this example. Here are my tables:create table mnagat.A ( a1 INTEGER, a2 INTEGER)UNIQUE PRIMARY INDEX ( a1, a2 )create table mnagat.B ( b1 INTEGER, b2 INTEGER, FOREIGN KEY ( b1, b2 ) REFERENCES A ( a1 , a2 ))Statements likeinsert into mnagat.B values (1, 1)are rejected as expected when there's no such record in A.But TD allows all these inserts, even when there's not any row on the A table:insert into mnagat.B values (null, null)insert into mnagat.B values (null, 1)insert into mnagat.B values (1, null)Shouldn't they be rejected by FK constraint (code 2700)?Thanks.

You must sign in to leave a comment.