Subject | Re: [firebird-support] primary key not null? |
---|---|
Author | Ann W. Harrison |
Post date | 2009-05-07T21:30:30Z |
Dimitry Sibiryakov wrote:
key be declared as NOT NULL. The PRIMARY KEY constraint imposes
NOT NULL implicitly. Other databases may require an explicit
NOT NULL - that' legal - but it's not required by the standard.
Good luck,
Ann
Just to be clear, NULLS are not allowed in a primary key, it's
just the stated NOT NULL constraint that's optional.
>> .... But my question is: It's normal that FB didn't complain about havingThe SQL standard does not required that fields used as a primary
>> a PK on a nullable column?
>
> I've just tested and it seems that FB silently added not null flag to
> field declared as primary key.
> If you create table with nullable column and then try to alter it
> adding primary key, FB will complain.
>
key be declared as NOT NULL. The PRIMARY KEY constraint imposes
NOT NULL implicitly. Other databases may require an explicit
NOT NULL - that' legal - but it's not required by the standard.
Good luck,
Ann
Just to be clear, NULLS are not allowed in a primary key, it's
just the stated NOT NULL constraint that's optional.