From: Adriano d. S. F. <adr...@gm...> - 2009-11-14 20:31:07
|
Vlad Khorsun wrote: >> I'm implementing what's described in subj. Now, user can already do this, but it's not good. > > Not sure i understand - what is not good ? > Current behavior is not good. Imagine a default expression with a generator being incremented every time a record is read. >> 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. > > Hmm, do you know why it returns 0 ? According to the said above it should evaluate expression > at time of reading record (also not perfect, but better than return zero). Looks like a bug. > It explicitly returns "0", I don't know why. See it in evl. But returning different dates/times everytime is what I said to be not good. >> Only simple expressions are allowed for DEFAULT now, with means more problems if complex expressions are allowed. > > Is standard allow to reference fileds from the same table in default expression ? > I don't know, but apparent don't make sense. But I see no problem in a function call being used, for example. >> 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. > > It is performance killer "solution" and i don't like it very much. > >> 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. > > Don't do it. System transaction should be read-only. > Formats are updated using it. ;-) Adriano |