sql/londiste: restore fkeys to local tables only
authorMarko Kreen <markokr@gmail.com>
Wed, 4 Nov 2009 12:24:54 +0000 (14:24 +0200)
committerMarko Kreen <markokr@gmail.com>
Wed, 4 Nov 2009 12:24:54 +0000 (14:24 +0200)
Fwd-port from 2.1-stable

sql/londiste/functions/londiste.handle_fkeys.sql

index 37be4ab5e64733dd1adb92dc79019bb9fa4183ca..d968be2f82390eecd610600ade34a5aa434a0d08 100644 (file)
@@ -49,10 +49,10 @@ begin
         from londiste.pending_fkeys pf
              left join londiste.table_info st_from on (st_from.table_name = pf.from_table)
              left join londiste.table_info st_to on (st_to.table_name = pf.to_table)
-        where (st_from.table_name is null or (st_from.merge_state = 'ok' and st_from.custom_snapshot is null))
-          and (st_to.table_name is null or (st_to.merge_state = 'ok' and st_to.custom_snapshot is null))
-          and (coalesce(st_from.queue_name = i_queue_name, false)
-               or coalesce(st_to.queue_name = i_queue_name, false))
+        where st_from.merge_state = 'ok' and st_from.custom_snapshot is null
+          and st_to.merge_state = 'ok' and st_to.custom_snapshot is null
+          and st_from.queue_name = i_queue_name
+          and st_to.queue_name = i_queue_name
         order by 1, 2, 3
     loop
         return next fkeys;