Update Change Check

Previous Next

See Also

For UPDATE statements, new column values are compared with old column values. If it turns out that the column is updated to the same value, the operation is not sent to the database.

Queried records that undergo updates or deletes are locked as soon as editing takes place in the record. At record validation time, however, for UPDATE statements the Rules Engine checks that old and new values of the manipulated record are different.

This is done by adding WHERE conditions in an attempt to detect as soon as possible that a constraint need not be evaluated.

Example

The SQL statement:

UPDATE tour SET max_age = 70

is expanded to:

UPDATE    tour

SET       max_age = 70

WHERE     max_age <> 70

OR        (max_age IS NULL AND 70 IS NOT NULL)

OR        (max_age IS NOT NULL AND 70 IS NULL)

The OR clauses are added only if applicable. This depends on the max_age column being mandatory or not and whether the expression can result in a NULL or not.