Subject | RE: [firebird-support] Domain not null, foreign key nullable? |
---|---|
Author | Roger Vellacott |
Post date | 2011-06-12T07:23:39Z |
If a field or its domain is defined as NOT NULL it does not allow null values.
You cannot at the same time both allow, and not allow, null values.
Roger Vellacott
CREATE DOMAIN account_nbr_domain VARCHAR(25) NOT NULL;
CREATE TABLE test_table
(
account_nbr account_nbr_domain PRIMARY KEY,
ref_account_nbr account_nbr DEFAULT NULL
);
INSERT INTO test_table (account_nbr, ref_account_nbr) VALUES ('test', NULL);
Firebird throws an exception saying that it cannot insert NULL into ref_account_nbr because of a validation constraint (because the domain is marked NOT NULLABLE).
Is there a way to make the column override the domain nullable constraint?
[Non-text portions of this message have been removed]
You cannot at the same time both allow, and not allow, null values.
Roger Vellacott
CREATE DOMAIN account_nbr_domain VARCHAR(25) NOT NULL;
CREATE TABLE test_table
(
account_nbr account_nbr_domain PRIMARY KEY,
ref_account_nbr account_nbr DEFAULT NULL
);
INSERT INTO test_table (account_nbr, ref_account_nbr) VALUES ('test', NULL);
Firebird throws an exception saying that it cannot insert NULL into ref_account_nbr because of a validation constraint (because the domain is marked NOT NULLABLE).
Is there a way to make the column override the domain nullable constraint?
[Non-text portions of this message have been removed]