PLPerl::CheckTrigger - a helper module for check_updates postgres triggers


use PLPerl::CheckTrigger;


This module is designed to be called from a PostgreSQL trigger function written in PL/Perlu. It provides 2 methods: check_columns and check_condition. These methods should be called from the row on update trigger. Their return value is 1 if the underlying operation (update) is allowed and 0 if it is denied.

check_columns gets a column list, an options list and old/new tuples for the relation. If options list has ALLOW_LIST option set, then only updates for columns from the specified list are allowed, otherwise updates for those and only those columns are denied.

check_condition gets a condition string and a list of columns and evaluates the condition using column values. Column names should be specified in a form (OLD|NEW).column, i.e. or OLD.val. Condition string uses % as a placeholder for column names.


Alexey Klyukin, <>. Development is sponsored by Enovafinancial (


This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.