Subject RE: [ib-support] NOT NULL constraints and the System Tables
Author Dmitry Yemanov
Hi Martijn,

> I noticed that the RDB$NULL_FLAG in the RDB$RELATION_FIELDS
> is set to 0 and
> the corresponding record in RDB$FIELDS has a NULL state for
> RDB$NULL_FLAG. I
> changed the RDB$NULL_FLAG in RDB$RELATION_FIELDS to NULL, but
> that didn't
> help... I still cannot insert NULLs into the column.
>
> What do I have to do to get the field NULLable and how do I
> do the reverse
> (NULLable to NOT NULLable).

Hmmm, weird. I used to try the following statement to drop the NOT NULL
constraint:

update RDB$RELATION_FIELDS
set RDB$NULL_FLAG = null
where RDB$FIELD_NAME = <FIELD_NAME>
and RDB$RELATION_NAME = <TABLE_NAME>;

and the following one to recreate it:

update RDB$RELATION_FIELDS
set RDB$NULL_FLAG = 1
where RDB$FIELD_NAME = <FIELD_NAME>
and RDB$RELATION_NAME = <TABLE_NAME>;

If my memory is correct, the both statements worked fine for me.

Cheers,
Dmitry