Skip to content

Commit

Permalink
Bug 128
Browse files Browse the repository at this point in the history
Check in setDropTable_int() if the underlying table still exists
before calling alterTableDropTriggers(). Emit a warning if the
table isn't found, but go ahead and remove the table from the
replication set.
  • Loading branch information
Jan Wieck authored and Jan Wieck committed Aug 27, 2010
1 parent fef8635 commit 1045aa5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/backend/slony1_funcs.sql
Expand Up @@ -2923,7 +2923,7 @@ begin
-- Ensure table exists
-- ----
if not found then
raise exception 'Slony-I: setDropTable_int(): table % not found',
raise exception 'Slony-I: setDropTable(): table % not found',
p_tab_id;
end if;

Expand Down Expand Up @@ -2973,10 +2973,11 @@ begin
-- ----
lock table @NAMESPACE@.sl_config_lock;

-- ----
-- Determine the set_id
-- ----
select tab_set into v_set_id from @NAMESPACE@.sl_table where tab_id = p_tab_id;
-- ----
-- Determine the set_id and table oid
-- ----
select tab_set, tab_reloid into v_set_id, v_tab_reloid
from @NAMESPACE@.sl_table where tab_id = p_tab_id;

-- ----
-- Ensure table exists
Expand Down Expand Up @@ -3011,7 +3012,12 @@ begin
-- ----
-- Drop the table from sl_table and drop trigger from it.
-- ----
perform @NAMESPACE@.alterTableDropTriggers(p_tab_id);
if exists (select 1 from pg_catalog.pg_class where oid = v_tab_reloid) then
perform @NAMESPACE@.alterTableDropTriggers(p_tab_id);
else
raise notice 'WARNING: table with id % (oid %) not found',
p_tab_id, v_tab_reloid;
end if;
delete from @NAMESPACE@.sl_table where tab_id = p_tab_id;
return p_tab_id;
end;
Expand Down

0 comments on commit 1045aa5

Please sign in to comment.