Subject Re: [firebird-support] Primary Key NULL!
Author Martijn Tonies
Hi,

> I came across this "Special" case. It seems that Firebird enforces
> not null in the primary key when you create the table. (Makes 100%
> sense) But sadly, it doesn't enforce the user from altering the
> field. I was able to do an ALTER Table and remove the not null from a
> primary composite key.

No, you weren't. At least not via a standard ALTER statement,
'cause the NULL/NOT NULL attribute cannot be changed this
way.

> Never the less, this causes havoc on a few tool, IB Experts and IBO
> Objects both goes nuts when they see a NULL in the primary key. IB
> Experts doesn't apply the a change on existing records, and IBO can't
> sync. Either way, this is a problem with them.
>
> If I update the field manually (UPDATE SQL) it works. So, I don't
> think there is a "Bug" in firebird, at least none that I've seen yet.
>
> My question is, shouldn't the primary key not null requirement be
> enforced ALSO when you do an alter? I don't think it makes any sense
> to allow nulls in a key.
>
> Oracle does enforces this when you do an alter. It generates polite
> message on your ignorance. :)
>
> I'm using firebird 1.5.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com