to compute and return value(s) based on each row inserted, updated, or
deleted. Any expression using the source or target table's columns, or
the merge_action()
- function can be computed. When an INSERT or
+ function can be computed. By default, when an INSERT or
UPDATE action is performed, the new values of the target
- table's columns are used. When a DELETE is performed,
- the old values of the target table's columns are used. The syntax of the
+ table's columns are used, and when a DELETE is performed,
+ the old values of the target table's columns are used, but it is also
+ possible to explicitly request old and new values. The syntax of the
RETURNING list is identical to that of the output list
of SELECT.
to compute and return value(s) based on each row actually updated.
Any expression using the table's columns, and/or columns of other
tables mentioned in FROM, can be computed.
- The new (post-update) values of the table's columns are used.
+ By default, the new (post-update) values of the table's columns are used,
+ but it is also possible to request the old (pre-update) values.
The syntax of the RETURNING list is identical to that of the
output list of SELECT.