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

Modified Files:
	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

Merged from 2.0 branch


Index: slony1_funcs.v83.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.v83.sql,v
retrieving revision 1.4
retrieving revision 1.5
diff -C 2 -d -r1.4 -r1.5
*** slony1_funcs.v83.sql	17 May 2010 17:16:29 -0000	1.4
--- slony1_funcs.v83.sql	5 Jul 2010 15:06:04 -0000	1.5
***************
*** 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.4
retrieving revision 1.5
diff -C 2 -d -r1.4 -r1.5
*** slony1_funcs.v84.sql	17 May 2010 17:16:29 -0000	1.4
--- slony1_funcs.v84.sql	5 Jul 2010 15:06:04 -0000	1.5
***************
*** 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.159
retrieving revision 1.160
diff -C 2 -d -r1.159 -r1.160
*** slony1_funcs.sql	13 May 2010 19:41:40 -0000	1.159
--- slony1_funcs.sql	5 Jul 2010 15:06:04 -0000	1.160
***************
*** 5596,5600 ****
  	-- delete on error.
  	-- ----
! 	execute 'truncate ' || @NAMESPACE at .slon_quote_input(v_tab_fqname);
  	raise notice 'truncate of % succeeded', v_tab_fqname;
  	-- ----
--- 5596,5600 ----
  	-- 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