londiste.global_add_table(): catch unique_violation
authorMarko Kreen <markokr@gmail.com>
Tue, 6 Jul 2010 12:23:49 +0000 (15:23 +0300)
committerMarko Kreen <markokr@gmail.com>
Fri, 9 Jul 2010 10:09:29 +0000 (13:09 +0300)
To avoid failure when both setup and replay add the table.

sql/londiste/functions/londiste.global_add_table.sql

index e64315cf088ef1fd704b1ac438659ed7e226c477..b3aebfc5946568fbcd1d8169d673c50b4616495d 100644 (file)
@@ -43,6 +43,13 @@ begin
     select 200, 'Table added: ' || i_table_name
         into ret_code, ret_note;
     return;
+
+exception
+    -- seems the row was added from parallel connection (setup vs. replay)
+    when unique_violation then
+        select 200, 'Table already added: ' || i_table_name
+            into ret_code, ret_note;
+        return;
 end;
 $$ language plpgsql strict;