londiste.local_add_table: ignore merge situation if copy is not needed
authorMarko Kreen <markokr@gmail.com>
Wed, 7 Dec 2011 10:15:01 +0000 (12:15 +0200)
committerMarko Kreen <markokr@gmail.com>
Wed, 7 Dec 2011 10:15:01 +0000 (12:15 +0200)
This allows unsyncromized adding in different leafs, with --expect-sync.

No reason to throw error in such case.

sql/londiste/functions/londiste.local_add_table.sql

index 27a7c54473f9772c5915a06d90b1a8e0c4965671..75d49ca0f7136fbe3c4647bbc38139faa5a8d4bb 100644 (file)
@@ -263,7 +263,7 @@ begin
         loop
             -- if table from some other source is already marked as local,
             -- raise error
-            if _local then
+            if _local and coalesce(new_state, 'x') <> 'ok' then
                 select 405, 'Found local table '|| _desc
                         || ' in queue ' || _queue_name
                         || ', use remove-table first to remove all previous '
@@ -274,7 +274,7 @@ begin
 
            -- when table comes from multiple sources, merge_all switch is
            -- required
-           if not _merge_all then
+           if not _merge_all and coalesce(new_state, 'x') <> 'ok' then
                select 405, 'Found multiple sources for table '|| _desc
                        || ', use merge-all or no-merge to continue'
                into ret_code, ret_note;