pgq_node.unregister_location: do automatic unsubscribe
authorMarko Kreen <markokr@gmail.com>
Mon, 21 May 2012 10:40:19 +0000 (13:40 +0300)
committerMarko Kreen <markokr@gmail.com>
Mon, 21 May 2012 10:40:19 +0000 (13:40 +0300)
There may be obsolete subscriptions around, do unsubscribe
automatically, instead complaining.

sql/pgq_node/functions/pgq_node.unregister_location.sql

index 62dc16519acf6ce20cfb3bf4774de1431e1960cf..9a189a3ea081c8bfd33b127828bbbc7ea601d59e 100644 (file)
@@ -48,6 +48,15 @@ begin
         end if;
     end if;
 
+    --
+    -- There may be obsolete subscriptions around
+    -- drop them silently.
+    --
+    perform pgq_node.unregister_subscriber(i_queue_name, i_node_name);
+
+    --
+    -- Actual removal
+    --
     delete from pgq_node.node_location
      where queue_name = i_queue_name
        and node_name = i_node_name;