Enabling and disabling column-level conflict resolution v5.6
Permissions required
Column-level conflict detection uses the column_timestamps
type. This type requires any user needing to detect column-level conflicts to have at least the bdr_application role assigned.
The bdr.alter_table_conflict_detection() function manages column-level conflict resolution.
Using bdr.alter_table_conflict_detection to enable column-level conflict resolution
The bdr.alter_table_conflict_detection function takes a table name and column name as its arguments. The column is added to the table as a column_modify_timestamp
column. The function also adds two triggers (BEFORE INSERT and BEFORE UPDATE) that are responsible for maintaining timestamps in the new column before each change.
The new column specifies NOT NULL
with a default value, which means that ALTER TABLE ... ADD COLUMN
doesn't perform a table rewrite.
Note
Avoid using columns with the bdr.column_timestamps
data type for other purposes, as doing so can have negative effects. For example, it switches the table to column-level conflict resolution, which doesn't work correctly without the triggers.
Listing tables with column-level conflict resolution
You can list tables having column-level conflict resolution enabled with the following query.
This query detects the presence of a column of type bdr.column_timestamp
.