Chris Browne cbbrowne at lists.slony.info
Wed Apr 18 12:26:56 PDT 2007
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv18264/src/backend

Modified Files:
	slony1_funcs.sql slony1_funcs.v73.sql slony1_funcs.v74.sql 
	slony1_funcs.v80.sql 
Log Message:
Applied changes made in 1.2 branch to fix "EXECUTE SCRIPT" only on a specified
node to HEAD.

Also fixed up a bunch of tests that were using TABLE ADD KEY (no longer
supported in HEAD).


Index: slony1_funcs.v73.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.v73.sql,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** slony1_funcs.v73.sql	11 Nov 2005 13:53:24 -0000	1.9
--- slony1_funcs.v73.sql	18 Apr 2007 19:26:54 -0000	1.10
***************
*** 103,104 ****
--- 103,113 ----
  'Returns 1 or 0 based on whether or not the DB is running a
  version earlier than 7.4';
+ 
+ create or replace function @NAMESPACE at .make_function_strict (text, text) returns void as
+ '
+    update "pg_catalog"."pg_proc" set proisstrict = ''t'' where 
+            proname = $1 and pronamespace = (select oid from "pg_catalog"."pg_namespace" where nspname = '_ at CLUSTERNAME@') and prolang = (select oid from "pg_catalog"."pg_language" where lanname = ''c'');
+ ' language sql;
+ 
+ comment on function @NAMESPACE at .make_function_strict (text, text) is
+ 'Equivalent to 8.1+ ALTER FUNCTION ... STRICT';

Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.107
retrieving revision 1.108
diff -C2 -d -r1.107 -r1.108
*** slony1_funcs.sql	18 Apr 2007 15:03:51 -0000	1.107
--- slony1_funcs.sql	18 Apr 2007 19:26:54 -0000	1.108
***************
*** 3691,3705 ****
  		raise exception ''Slony-I: set % not found'', p_set_id;
  	end if;
! 	if v_set_origin <> @NAMESPACE at .getLocalNodeId(''_ at CLUSTERNAME@'') then
! 		raise exception ''Slony-I: set % does not originate on local node'',
  				p_set_id;
  	end if;
- 
- 	-- ----
- 	-- Create a SYNC event, run the script and generate the DDL_SCRIPT event
- 	-- ----
-     perform @NAMESPACE at .alterTableRestore(tab_id) from @NAMESPACE at .sl_table where tab_set in (select set_id from @NAMESPACE at .sl_set where set_origin = @NAMESPACE at .getLocalNodeId(''_ at CLUSTERNAME@''));
- 
- 	perform @NAMESPACE at .createEvent(''_ at CLUSTERNAME@'', ''SYNC'', NULL);
  	return 1;
  end;
--- 3691,3710 ----
  		raise exception ''Slony-I: set % not found'', p_set_id;
  	end if;
! 	if p_only_on_node = -1 then
! 		if v_set_origin <> @NAMESPACE at .getLocalNodeId(''_ at CLUSTERNAME@'') then
! 			raise exception ''Slony-I: set % does not originate on local node'',
  				p_set_id;
+ 		end if;
+ 		-- ----
+ 		-- Create a SYNC event, run the script and generate the DDL_SCRIPT event
+ 		-- ----
+ 		perform @NAMESPACE at .createEvent(''_ at CLUSTERNAME@'', ''SYNC'', NULL);
+ 		perform @NAMESPACE at .alterTableRestore(tab_id) from @NAMESPACE at .sl_table where tab_set in (select set_id from @NAMESPACE at .sl_set where set_origin = @NAMESPACE at .getLocalNodeId(''_ at CLUSTERNAME@''));
+ 	else
+ 		-- ----
+ 		-- If doing "only on one node" - restore ALL tables irrespective of set
+ 		-- ----
+ 		perform @NAMESPACE at .alterTableRestore(tab_id) from @NAMESPACE at .sl_table;
  	end if;
  	return 1;
  end;
***************
*** 3726,3732 ****
  begin
  	perform @NAMESPACE at .updateRelname(p_set_id, p_only_on_node);
!     perform @NAMESPACE at .alterTableForReplication(tab_id) from @NAMESPACE at .sl_table where tab_set in (select set_id from @NAMESPACE at .sl_set where set_origin = @NAMESPACE at .getLocalNodeId(''_ at CLUSTERNAME@''));
! 	return  @NAMESPACE at .createEvent(''_ at CLUSTERNAME@'', ''DDL_SCRIPT'', 
  			p_set_id, p_script, p_only_on_node);
  end;
  ' language plpgsql;
--- 3731,3743 ----
  begin
  	perform @NAMESPACE at .updateRelname(p_set_id, p_only_on_node);
! 	if p_only_on_node = -1 then
! 		perform @NAMESPACE at .alterTableForReplication(tab_id) from @NAMESPACE at .sl_table where tab_set in (select set_id from @NAMESPACE at .sl_set where set_origin = @NAMESPACE at .getLocalNodeId(''_ at CLUSTERNAME@''));
! 
! 		return  @NAMESPACE at .createEvent(''_ at CLUSTERNAME@'', ''DDL_SCRIPT'', 
  			p_set_id, p_script, p_only_on_node);
+ 	else
+ 		perform @NAMESPACE at .alterTableForReplication(tab_id) from @NAMESPACE at .sl_table;
+ 	end if;
+ 	return NULL;
  end;
  ' language plpgsql;

Index: slony1_funcs.v80.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.v80.sql,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** slony1_funcs.v80.sql	8 Feb 2007 18:01:15 -0000	1.4
--- slony1_funcs.v80.sql	18 Apr 2007 19:26:54 -0000	1.5
***************
*** 116,125 ****
  version earlier than 7.4';
  
! create or replace function @NAMESPACE at .make_function_strict (text, text) returns void as
  '
     update "pg_catalog"."pg_proc" set proisstrict = ''t'' where 
!      proname = $1 and pronamespace = (select oid from "pg_catalog"."pg_namespace" where nspname = '@NAMESPACE@') and prolang = (select oid from "pg_catalog"."pg_language" where lanname = ''c'');
! ' language sql;
  
  comment on function @NAMESPACE at .make_function_strict (text, text) is
! 'Equivalent to 8.1+ ALTER FUNCTION ... STRICT';
\ No newline at end of file
--- 116,128 ----
  version earlier than 7.4';
  
! create or replace function @NAMESPACE at .make_function_strict (text, text) returns integer as
  '
+ begin
     update "pg_catalog"."pg_proc" set proisstrict = ''t'' where 
!      proname = $1 and pronamespace = (select oid from "pg_catalog"."pg_namespace" where nspname = ''_ at CLUSTERNAME@'') and prolang = (select oid from "pg_catalog"."pg_language" where lanname = ''c'');
!    return 1 ;
! end
! ' language plpgsql;
  
  comment on function @NAMESPACE at .make_function_strict (text, text) is
! 'Equivalent to 8.1+ ALTER FUNCTION ... STRICT';

Index: slony1_funcs.v74.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.v74.sql,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** slony1_funcs.v74.sql	14 Mar 2007 15:53:16 -0000	1.10
--- slony1_funcs.v74.sql	18 Apr 2007 19:26:54 -0000	1.11
***************
*** 103,111 ****
  'Returns 1 or 0 based on whether or not the DB is running a
  version earlier than 7.4';
  create or replace function @NAMESPACE at .make_function_strict (text, text) returns void as
  '
     update "pg_catalog"."pg_proc" set proisstrict = ''t'' where 
!            proname = $1 and pronamespace = (select oid from "pg_catalog"."pg_namespace" where nspname = ''_ at CLUSTERNAME@'') and prolang = (select oid from "pg_catalog"."pg_language" where lanname = ''c'');
! ' language sql;
  
  comment on function @NAMESPACE at .make_function_strict (text, text) is
--- 103,115 ----
  'Returns 1 or 0 based on whether or not the DB is running a
  version earlier than 7.4';
+ 
  create or replace function @NAMESPACE at .make_function_strict (text, text) returns void as
  '
+ begin
     update "pg_catalog"."pg_proc" set proisstrict = ''t'' where 
!      proname = $1 and pronamespace = (select oid from "pg_catalog"."pg_namespace" where nspname = ''_ at CLUSTERNAME@'') and prolang = (select oid from "pg_catalog"."pg_language" where lanname = ''c'');
!    return 1 ;
! end
! ' language plpgsql;
  
  comment on function @NAMESPACE at .make_function_strict (text, text) is



More information about the Slony1-commit mailing list