Steve Singer,,, ssinger at lists.slony.info
Mon Jul 5 08:04:42 PDT 2010
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv29896/src/backend

Modified Files:
      Tag: REL_2_0_STABLE
	slony1_funcs.v83.sql slony1_funcs.v84.sql slony1_funcs.sql 
Log Message:
In 8.4 and above use TRUNCATE ONLY instead of TRUNCATE when
cleaning out tables before a subscription.  TRUNCATE ONLY
behaves as TRUNCTE did in 8.3.
    
This fixes bug # 118 - subscribing to a set with an inherited
table  where the inheriting table has a lower tab_id than the
parent table deletes all of the data in the parent table



Index: slony1_funcs.v83.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.v83.sql,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C 2 -d -r1.1.2.3 -r1.1.2.4
*** slony1_funcs.v83.sql	17 May 2010 17:15:19 -0000	1.1.2.3
--- slony1_funcs.v83.sql	5 Jul 2010 15:04:40 -0000	1.1.2.4
***************
*** 53,54 ****
--- 53,69 ----
  comment on function @NAMESPACE at .ShouldSlonyVacuumTable (name, name) is 
  'returns false if autovacuum handles vacuuming of the table, or if the table does not exist; returns true if Slony-I should manage it';
+ 
+ 
+ 
+ 
+ create or replace function @NAMESPACE at .TruncateOnlyTable ( name) returns void as
+ $$
+ begin
+ 	execute 'truncate '|| @NAMESPACE at .slon_quote_input($1);
+ end;
+ $$
+ LANGUAGE plpgsql;
+ 
+ 
+ comment on function @NAMESPACE at .TruncateOnlyTable(name) is
+ 'Calls TRUNCATE with out specifying ONLY, syntax supported in version 8.3';

Index: slony1_funcs.v84.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.v84.sql,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C 2 -d -r1.1.2.3 -r1.1.2.4
*** slony1_funcs.v84.sql	17 May 2010 17:15:19 -0000	1.1.2.3
--- slony1_funcs.v84.sql	5 Jul 2010 15:04:40 -0000	1.1.2.4
***************
*** 54,55 ****
--- 54,65 ----
  'returns false if autovacuum handles vacuuming of the table, or if the table does not exist; returns true if Slony-I should manage it';
  
+ create or replace function @NAMESPACE at .TruncateOnlyTable ( name) returns void as
+ $$
+ begin
+ 	execute 'truncate only '|| @NAMESPACE at .slon_quote_input($1);
+ end;
+ $$
+ LANGUAGE plpgsql;
+ 
+ comment on function @NAMESPACE at .TruncateOnlyTable(name) is
+ 'Calls TRUNCATE ONLY, syntax supported in version >= 8.4';

Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.145.2.28
retrieving revision 1.145.2.29
diff -C 2 -d -r1.145.2.28 -r1.145.2.29
*** slony1_funcs.sql	28 May 2010 13:22:51 -0000	1.145.2.28
--- slony1_funcs.sql	5 Jul 2010 15:04:40 -0000	1.145.2.29
***************
*** 5597,5601 ****
  	-- delete on error.
  	-- ----
! 	execute 'truncate ' || @NAMESPACE at .slon_quote_input(v_tab_fqname);
  	raise notice 'truncate of % succeeded', v_tab_fqname;
  	-- ----
--- 5597,5601 ----
  	-- delete on error.
  	-- ----
! 	perform @NAMESPACE at .TruncateOnlyTable(v_tab_fqname);
  	raise notice 'truncate of % succeeded', v_tab_fqname;
  	-- ----



More information about the Slony1-commit mailing list