I'm just altering the COMPUTE expression of a table with existing data. (This is V18.104.22.16801.)
As documented, this re-computes not only the particular column addressed in the ALTER TABLE ... SET COMPUTE statement but does re-compute all computed columns in this table (and in this case, this is absolutely wanted behaviour:).
Since the table has the usual DEFAULT TIMESTAMP column, I wasn't sure if this column is changed, too - however, it isn't.
Is this expected behaviour for DEFAULT TIMESTAMP, i.e. will those values only change by UPDATE statements, but not by those data modifications as result of an ALTER TABLE statement (e.g. altering computed values, adding columns with defaults and the like)?
I'm just asking for a better understanding...
Being no iAnywhere staff member, obviously I can't claim whether this is intended behaviour or not.
That being said, I suggest that the current behaviour should be documented, as changing rows by ALTERing the table seems quite similar to changing rows by updates. Therefore I guess my question is not too uncommon.
However, I bet in most cases DEFAULT TIMESTAMP is used to track changes by ordinary DML statements - in the sense of "when was that row modified at last". It's usually meant for changes by users / application programs.
When doing clean-up or other administrative tasks in such tables, I often want the particular DEFAULT TIMESTAMP column to stay unchanged to "hide" my adminstrative changes. That's easily done with an UPDATE statement that sets the DEFAULT TIMESTAMP column to its current value. And as usually, if the UPDATE statement specifies a value for this column, the default value isn't applied.
So, with UPDATE, I'm quite free to choose whether I want DEFAULT TIMESTAMP to be updated or not.
However, if ALTER TABLE would change the DEFAULT TIMESTAMP, there wouldn't be a way to prevent this change (at least without an enhanced syntax). Therefore the current behaviour seems reasonable as