Subject Re: [firebird-support] Re: Firebird 2.5 (64 bit), strange SQL result
Author Mark Rotteveel
On Wed, 09 May 2012 03:40:52 -0000, "trskopo" <trskopo@...> wrote:
> 3) change id's column def
> UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = 1
> WHERE RDB$FIELD_NAME = 'ID' AND RDB$RELATION_NAME = 'TEST';

You should *not* modify the system tables directly to achieve this, but
use DDL to do this. For all you know the DDL does additional checks and
table changes that won't occur when you manipulate the system tables. In
other words: always use DDL if it is available, and only modify system
tables if there really is no other way.

> 4) select a table
> select * from test (via flamerobin)
> result :
>
> ID NM
> [null] test1
> 2 test2
>
> From those test, I think :
> 1) Firebird didn't raise an error when set null column into not null
> column (so I have to be more careful in the future)

That is documented behavior; behavior which might be annoying, but I think
it is almost impossible to do otherwise on a MVCC-type database like
Firebird (there might be active transaction which modified or inserted
records with a NULL value). Also: if Firebird would throw an error for
this, it can't do that if you directly manipulate the system tables.