From 0c96146e959a5924229b04130613110b3bef299c Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Thu, 2 Dec 2010 15:39:50 +0200 Subject: [PATCH] londiste.local_add_table: no_triggers and expect_sync magic args --- .../functions/londiste.local_add_table.sql | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sql/londiste/functions/londiste.local_add_table.sql b/sql/londiste/functions/londiste.local_add_table.sql index 156d939d..3fce3c6e 100644 --- a/sql/londiste/functions/londiste.local_add_table.sql +++ b/sql/londiste/functions/londiste.local_add_table.sql @@ -13,11 +13,17 @@ as $$ -- Parameters: -- i_queue_name - queue name -- i_table_name - table name --- i_trg_args - args to trigger, or tgflags=X for trigger creation flags +-- i_trg_args - args to trigger, or magic parameters. -- -- Trigger args: -- See documentation for pgq triggers. -- +-- Magic parameters: +-- no_triggers - skip trigger creation +-- skip_truncate - set 'skip_truncate' table attribute +-- expect_sync - set table state to 'ok' +-- tgflags=X - trigger creation flags +-- -- Trigger creation flags (default: AIUDL): -- I - ON INSERT -- U - ON UPDATE @@ -121,6 +127,8 @@ begin perform londiste.root_notify_change(i_queue_name, 'londiste.add-table', fq_table_name); elsif _node.node_type = 'leaf' and _node.combined_type = 'branch' then new_state := 'ok'; + elsif 'expect_sync' = any (i_trg_args) then + new_state := 'ok'; else new_state := NULL; end if; @@ -190,6 +198,13 @@ begin if position('S' in arg) > 0 then lg_args := lg_args || ', ' || quote_literal('SKIP'); end if; + elsif arg = 'expect_sync' then + -- already handled + elsif arg = 'skip_truncate' then + perform 1 from londiste.local_set_table_attrs(i_queue_name, fq_table_name, 'skip_truncate=1'); + elsif arg = 'no_triggers' then + select 200, 'Table added with no triggers: ' || fq_table_name into ret_code, ret_note; + return; else -- ordinary arg lg_args := lg_args || ', ' || quote_literal(arg); -- 2.39.5