summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartinko2013-03-19 14:43:12 +0000
committermartinko2013-03-19 14:43:12 +0000
commitf43936a82500dae8e82f05d050cd71de9124d974 (patch)
tree1c27b43e93e23b794a87326674a01cad322b4710
parent5a53f0c62c7ef557280ed781e9d90182a064d426 (diff)
londiste.create_trigger: fixed compatibility with postgres 9+
-rw-r--r--sql/londiste/functions/londiste.create_trigger.sql12
1 files changed, 6 insertions, 6 deletions
diff --git a/sql/londiste/functions/londiste.create_trigger.sql b/sql/londiste/functions/londiste.create_trigger.sql
index 336460ed..01cf6e4f 100644
--- a/sql/londiste/functions/londiste.create_trigger.sql
+++ b/sql/londiste/functions/londiste.create_trigger.sql
@@ -61,8 +61,8 @@ declare
_tgflags char[];
-- ordinary argument array
_args text[];
- -- array with all tgflags values
- _check_flags char[] := array['B','A','Q','L','I','U','D','S'];
+ -- array with all valid tgflags values
+ _valid_flags char[] := array['B','A','Q','L','I','U','D','S'];
-- argument flags
_skip boolean := false;
_no_triggers boolean := false;
@@ -75,9 +75,9 @@ begin
if arg like 'tgflags=%' then
-- special flag handling
arg := upper(substr(arg, 9));
- for j in array_lower(_check_flags, 1) .. array_upper(_check_flags, 1) loop
- if position(_check_flags[j] in arg) > 0 then
- _tgflags := array_append(_tgflags, _check_flags[j]);
+ for j in array_lower(_valid_flags, 1) .. array_upper(_valid_flags, 1) loop
+ if position(_valid_flags[j] in arg) > 0 then
+ _tgflags := array_append(_tgflags, _valid_flags[j]);
end if;
end loop;
elsif arg = 'no_triggers' then
@@ -157,7 +157,7 @@ begin
into _skip_trg_count, _skip_trg_name
from pg_catalog.pg_trigger t
where t.tgrelid = londiste.find_table_oid(i_dest_table)
- and position(E'\\000skip\\000' in lower(tgargs::text)) > 0;
+ and position(E'\\000SKIP\\000'::bytea in tgargs) > 0;
-- if no previous skip triggers, prefix name and add SKIP to args
if _skip_trg_count = 0 then
trigger_name := _skip_prefix || trigger_name;