Stream triggers row functions v5.6
bdr.trigger_get_row
This function returns the contents of a trigger row specified by an identifier
as a RECORD
. This function returns NULL
if called inappropriately, that is,
called with SOURCE_NEW
when the operation type (TG_OP) is DELETE
.
Synopsis
Parameters
row_id
— Identifier of the row. Can be any ofSOURCE_NEW
,SOURCE_OLD
, andTARGET
, depending on the trigger type and operation. (See the descriptions of the individual trigger types.)
bdr.trigger_get_committs
This function returns the commit timestamp of a trigger row specified by an
identifier. If not available because a row is frozen or isn't available,
returns NULL
. Always returns NULL
for row identifier SOURCE_OLD
.
Synopsis
Parameters
row_id
— Identifier of the row. Can be any ofSOURCE_NEW
,SOURCE_OLD
, andTARGET
, depending on trigger type and operation. (See the descriptions of the individual trigger types.)
bdr.trigger_get_xid
This function returns the local transaction id of a TARGET row specified by an
identifier. If not available because a row is frozen or isn't available,
returns NULL
. Always returns NULL
for SOURCE_OLD
and SOURCE_NEW
row
identifiers.
Available only for conflict triggers.
Synopsis
Parameters
row_id
— Identifier of the row. Can be any ofSOURCE_NEW
,SOURCE_OLD
, andTARGET
, depending on trigger type and operation. (See the descriptions of the individual trigger types.)
bdr.trigger_get_type
This function returns the current trigger type, which can be CONFLICT
or TRANSFORM
. Returns null if called outside a stream trigger.
Synopsis
bdr.trigger_get_conflict_type
This function returns the current conflict type if called inside a conflict
trigger. Otherwise, returns NULL
.
See Conflict types for possible return values of this function.
Synopsis
bdr.trigger_get_origin_node_id
This function returns the node id corresponding to the origin for the trigger
row_id passed in as argument. If the origin isn't valid (which means the row
originated locally), returns the node id of the source or target node,
depending on the trigger row argument. Always returns NULL
for row identifier
SOURCE_OLD
. You can use this function to define conflict triggers to always favor a
trusted source node.
Synopsis
Parameters
row_id
— Identifier of the row. Can be any ofSOURCE_NEW
,SOURCE_OLD
, andTARGET
, depending on trigger type and operation. (See the descriptions of the individual trigger types.)
bdr.ri_fkey_on_del_trigger
When called as a BEFORE trigger, this function uses FOREIGN KEY information to avoid FK anomalies.