Bug report from Glyn Still -- Hi Guys, Just had an issue with subscribe set in 2.0.6. From what I can see somehow slonik is passing parameters to reshapesubscription in the wrong order, instead of (sub_set, sub_provider, sub_receiver) it seems to be sending (sub_provider, sub_set, sub_receiver). In turn that made slonik hang on me and borked my subscriptions. Here's what I submitted to slonik: SUBSCRIBE SET ( ID = 1000, PROVIDER = 4, RECEIVER = 5, FORWARD = YES ); Here's the error message I get from slonik: Way5b:/pgsql/slony# slonik reshape.scr reshape.scr:17: ATTEMPT: SUBSCRIBE SET reshape.scr:18: NOTICE: subscribe set: omit_copy=f reshape.scr:18: NOTICE: subscribe set: omit_copy=f CONTEXT: SQL statement "SELECT "_main_replication".subscribeSet_int( $1 , $2 , $3 , $4 , $5 )" PL/pgSQL function "subscribeset" line 77 at PERFORM reshape.scr:18: PGRES_FATAL_ERROR select "_main_replication".reshapeSubscription(4,1000,5); - ERROR: insert or update on table "sl_subscribe" violates foreign key constraint "sl_subscribe-sl_path-ref" DETAIL: Key (sub_provider,sub_receiver)=(1000,5) is not present in table "sl_path". CONTEXT: SQL statement "update "_main_replication".sl_subscribe set sub_provider= $1 WHERE sub_set= $2 AND sub_receiver= $3 " PL/pgSQL function "reshapesubscription" line 11 at SQL statement error reshaping subscriber And here's what my reshapesubscription looks like: CREATE OR REPLACE FUNCTION _main_replication.reshapesubscription(integer, integer, integer) RETURNS integer AS $BODY$ declare p_sub_set alias for $1; p_sub_provider alias for $2; p_sub_receiver alias for $3; begin -- ---- -- Grab the central configuration lock -- ---- lock table "_main_replication".sl_config_lock; update "_main_replication".sl_subscribe set sub_provider=p_sub_provider WHERE sub_set=p_sub_set AND sub_receiver=p_sub_receiver; if found then perform "_main_replication".RebuildListenEntries(); notify "_main_replication_Restart"; end if; return 0; end $BODY$ LANGUAGE plpgsql VOLATILE; Looking in the slonik.c starting on on line 3541 I can see the following: slon_mkquery(&query, "select \"_%s\".reshapeSubscription(%d,%d,%d);", stmt->hdr.script->clustername, stmt->sub_provider,stmt->sub_setid, stmt->sub_receiver); Unless I'm going crazy (It is now 4am), that pretty much looks the wrong way around to me? Thanks Glyn
Created attachment 106 [details] proposed fix Proposed fix. Will need to be applied against both master and REL_2_0_STABLE
+1 from me
Applied to master http://git.postgresql.org/gitweb?p=slony1-engine.git;a=commit;h=46faa6b75f2fddcab98d317b91584cfffad749b4 REL_2_0_STABLE http://git.postgresql.org/gitweb?p=slony1-engine.git;a=commit;h=8f681a8cb06571396b8e99be220a38f92f1d3baf