returns int4 as $$
-- updates table structure if necessary
declare
+ pgversion int;
cnt int4 = 0;
begin
+ show server_version_num into pgversion;
-- table_info: check (dropped_ddl is null or merge_state in ('in-copy', 'catching-up'))
perform 1 from information_schema.check_constraints
end if;
-- table_info: change trigger timing
- perform 1 from information_schema.triggers
- where event_object_schema = 'londiste'
- and event_object_table = 'table_info'
- and trigger_name = 'table_info_trigger_sync'
- and condition_timing = 'AFTER';
+ if pgversion >= 90100 then
+ perform 1 from information_schema.triggers
+ where event_object_schema = 'londiste'
+ and event_object_table = 'table_info'
+ and trigger_name = 'table_info_trigger_sync'
+ and action_timing = 'AFTER';
+ else
+ perform 1 from information_schema.triggers
+ where event_object_schema = 'londiste'
+ and event_object_table = 'table_info'
+ and trigger_name = 'table_info_trigger_sync'
+ and condition_timing = 'AFTER';
+ end if;
if found then
drop trigger table_info_trigger_sync on londiste.table_info;
create trigger table_info_trigger_sync before delete on londiste.table_info