diff options
| author | martinko | 2014-03-17 15:21:50 +0000 |
|---|---|---|
| committer | martinko | 2014-03-17 15:21:50 +0000 |
| commit | 3df4de6a915fb1ff3247a5f322bef2752fa9b227 (patch) | |
| tree | d39375da8126d6a91b986277968f151b9829940f | |
| parent | 03a7b33b1603eabe2c88c90b2c2d0caf9bf6af5f (diff) | |
londiste.upgrade_schema: fixed condition_timing vs action_timing
| -rw-r--r-- | sql/londiste/functions/londiste.upgrade_schema.sql | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sql/londiste/functions/londiste.upgrade_schema.sql b/sql/londiste/functions/londiste.upgrade_schema.sql index 508daea2..c0cf2986 100644 --- a/sql/londiste/functions/londiste.upgrade_schema.sql +++ b/sql/londiste/functions/londiste.upgrade_schema.sql @@ -3,8 +3,10 @@ create or replace function londiste.upgrade_schema() 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 @@ -29,11 +31,19 @@ begin 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 |
