Skip to content

Commit

Permalink
Bug #1362 - subscribeSet() must check that the provider itself is a f…
Browse files Browse the repository at this point in the history
…orwarding subscriber

As checked into HEAD...

Change subscribeSet() to validate that the provider is either the origin
or a forwarding active subscriber
  • Loading branch information
Christopher Browne committed Jul 13, 2005
1 parent 89ec75d commit eb42a57
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/backend/slony1_funcs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
-- Copyright (c) 2003-2004, PostgreSQL Global Development Group
-- Author: Jan Wieck, Afilias USA INC.
--
-- $Id: slony1_funcs.sql,v 1.15.2.17 2005-06-10 22:06:30 wieck Exp $
-- $Id: slony1_funcs.sql,v 1.15.2.18 2005-07-13 19:58:06 cbbrowne Exp $
-- ----------------------------------------------------------------------


Expand Down Expand Up @@ -3434,6 +3434,7 @@ declare
p_sub_receiver alias for $3;
p_sub_forward alias for $4;
v_set_origin int4;
v_rec record;
begin
-- ----
-- Grab the central configuration lock
Expand Down Expand Up @@ -3476,6 +3477,20 @@ begin
raise notice ''http://gborg.postgresql.org/project/slony1/bugs/bugupdate.php?1226'';
end if;
-- ---
-- Verify that the provider is either the origin or an active subscriber
-- Bug report #1362
-- ---
if v_set_origin <> p_sub_provider then
select 1 into v_rec from @NAMESPACE@.sl_subscribe
where sub_set = p_sub_set and
sub_receiver = p_sub_provider and
sub_forward and sub_active;
if not found then
raise exception ''Slony-I: provider % is not an active forwarding node for replication set %'', p_sub_provider, p_sub_set;
end if;
end if;
-- ----
-- Call the internal procedure to store the subscription
-- ----
Expand Down

0 comments on commit eb42a57

Please sign in to comment.