- In the current release (v7.0),
Postgres
- evaluates all default expressions at the time the table is defined.
- Hence, functions which are "non-cacheable" such as
- CURRENT_TIMESTAMP may not produce the desired
- effect. For the particular case of date/time types, one can work
- around this behavior by using
- DEFAULT TEXT 'now'
- instead of
- DEFAULT 'now'
- or
- DEFAULT CURRENT_TIMESTAMP
.
- This forces
Postgres to consider the constant a string
- type and then to convert the value to timestamp at runtime.
-