There appears to be absolutely zero documentation regarding the expected 
format of a custom conflict handler function.

I'm attempting to define a custom conflict handler for a test bdr 
cluster. When I tried to register a generic function with no parameters 
I get a somewhat useful error message which states that the function is 
expected to have a signature like this:

select * from bdr.bdr_create_conflict_handler('test', 
'customconflictmgr', 
'test_conflict_trigger()', 'update_update');

ERROR: conflict handler function signature must be (IN tablerow, IN 
tablerow, IN text, IN regclass, IN bdr.bdr_conflict_type, OUT tablerow, 
OUT bdr.bdr_conflict_handler_action)
SQL state: XX000
Hint: OUT argument are not of the expected types.

So I then attempted to define a function with specified signature:

select * from bdr.bdr_replicate_ddl_command('
CREATE OR REPLACE FUNCTION public.test_conflict_trigger(IN r1 tablerow, 
IN r2 tablerow, IN t1 text, IN rc1 regclass, IN c1 
bdr.bdr_conflict_type, OUT rout tablerow, OUT a1 
bdr.bdr_conflict_handler_action)
  RETURNS record AS
$BODY$
BEGIN
        raise notice ''conflict detected in test table'';
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION public.test_conflict_trigger(IN r1 oid, IN r2 oid, IN t1 
text, IN rc1 regclass, IN c1 bdr.bdr_conflict_type, OUT rout text, OUT 
a1 bdr.bdr_conflict_handler_action)
  OWNER TO postgres;
');


and get this error:
ERROR:  type tablerow does not exist

What is tablerow type???????? Does there exist anywhere an example of a 
custom conflict handler function???




-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to