Jamie Lawrence <postgres(at)jal(dot)org> writes:
> I had thought that if moddate isn't included in an insert or update,
> that it would be null in the NEW context,
No, it would be whatever the value to be assigned to the column would
be, if the trigger were not present. In particular, during an UPDATE
it's going to contain the old value of the field. In an INSERT it would
be whatever the column's default value is.
I am not sure what your intention is here. If you want the trigger to
force the field to current time, it can certainly do that. If you want
the user to control whether the field is updated, why do you need a
trigger at all?
regards, tom lane