From: Adriano d. S. F. <adr...@gm...> - 2009-11-14 17:02:27
|
Hi! I'm implementing what's described in subj. Now, user can already do this, but it's not good. When engine reads a NOT NULL field with a DEFAULT, it executed the DEFAULT expression and returns a value. For CURRENT_DATE/TIME/TIMESTAMP expressions, it returns the "0 value", with for dates means 1858-11-17. Only simple expressions are allowed for DEFAULT now, with means more problems if complex expressions are allowed. Initial verification to implement the thing in a good way has to populate the fields in DFW, after the new format has been created. This does not solve the problem completely. There can be snapshot transactions that see the new field but can't see its default value. Related to above, I tried to update records in system transaction. Initially works in some condition, but I don't think it's good way to go either. So I think on an alternate way. At field creation time, its default value may be written in RDB$FORMATS. When reading a NOT NULL field with a DEFAULT, the value written in the format version of the record is returned. This may solve the problem of complex expressions, the problem of transaction visibility, and don't need an update on the whole table. I've no code to prove this, it's just an idea. What do you think? Adriano |