Subject Re: [IBO] default value in table field
Author Nando Dessena
Helen,

> First, as to why this is happening: by making a UNIQUE constraint on NFILE_UP you have indirectly caused it to have a NOT NULL constraint as well. How this occurs is that IB automatically creates a unique index on the constrained column, and a unique index value in IB cannot evaluate to NULL. (As I have stated elsewhere, I consider this to be a bug. It should not be permissible to apply a UNIQUE constraint to a nullable column. Opinions differ. My argument is that the current situation causes problems like the one you are having!)

actually, it simply happens because Adalberto has defined the column as
NOT NULL, otherwise IB would have prevented him to create an UNIQUE
constraint; in short, all is working as expected (you may have missed
the NOT NULL clause).

I agree about the proposed solution.

To add something actually useful <g> Adalberto could give the field a
value (anything would do) in the OnNewRecord, AfterInsert or BeforePost
event handlers.
In addition, if the goal is (as it seems) to have an uppercase
equivalent, Adalberto should add a BEFORE UPDATE trigger with almost the
same code he put in the BEFORE INSERT trigger, and anyway get rid of
that DEFAULT CURRENT_TIMESTAMP clause which is both ugly and useless.

Throwing the Table object out of the window in favour of a Query object
that doesn't select the uppercase equivalent could be a good thing too.

HTH
--
____
_/\/ando