Subject | Re: Domain not null, foreign key nullable? |
---|---|
Author | firebirdsql |
Post date | 2011-06-12T13:05:42Z |
I use the domain for foreign keys which sometimes can be nullable. The column's nullable value (if one is set) should therefore override the domain's nullable value.
--- In firebird-support@yahoogroups.com, Roger Vellacott <rvellacott@...> wrote:
>
> 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]
>