gis
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
store_conflicts
Description
Store resolved conflicts in the central database lizsync.conflicts table.
Parameters
Name
Type
Mode
number_conflicts
integer
OUT
Definition
DECLARE sqltemplate text; dblink_connection_name text; dblink_msg text; p_clone_id text; p_number_conflicts integer; BEGIN -- Count conflicts to store SELECT count(tid) FROM temp_conflicts INTO p_number_conflicts ; -- Get clone server id SELECT server_id::text INTO p_clone_id FROM lizsync.server_metadata LIMIT 1; -- Insert into foreign table central_lizsync.conflicts_bis -- To let the foreign server use default values -- for id and conflict time INSERT INTO central_lizsync.conflicts_bis ( "object_table", "object_uid", "clone_id", "central_event_id", "central_event_timestamp", "central_sql", "clone_sql", "rejected", "rule_applied" ) SELECT c.object_table, c.object_uid, p_clone_id::uuid, c.central_event_id, c.central_event_timestamp, c.central_sql, c.clone_sql, c.rejected, c.rule_applied FROM temp_conflicts AS c ORDER BY tid ; -- Return RETURN QUERY SELECT p_number_conflicts; END;