Chris Browne cbbrowne at lists.slony.info
Mon Aug 10 08:34:22 PDT 2009
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv15801/src/backend

Modified Files:
      Tag: REL_2_0_STABLE
	slony1_funcs.sql 
Log Message:
Change numerous cases where integer values are appended onto strings to
specifically cast to text.  This addresses the issue where, in 8.3+,
casts aren't done as much implicitly


Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.145.2.15
retrieving revision 1.145.2.16
diff -C2 -d -r1.145.2.15 -r1.145.2.16
*** slony1_funcs.sql	31 Jul 2009 19:20:26 -0000	1.145.2.15
--- slony1_funcs.sql	10 Aug 2009 15:34:19 -0000	1.145.2.16
***************
*** 448,454 ****
  as $$
  begin
! 	return @NAMESPACE at .slonyVersionMajor() || '.' || 
! 	       @NAMESPACE at .slonyVersionMinor() || '.' || 
! 	       @NAMESPACE at .slonyVersionPatchlevel();
  end;
  $$ language plpgsql;
--- 448,454 ----
  as $$
  begin
! 	return @NAMESPACE at .slonyVersionMajor()::text || '.' || 
! 	       @NAMESPACE at .slonyVersionMinor()::text || '.' || 
! 	       @NAMESPACE at .slonyVersionPatchlevel()::text;
  end;
  $$ language plpgsql;
***************
*** 3571,3575 ****
  	-- ----
  	execute 'select setval(''' || v_fqname ||
! 			''', ' || p_last_value || ')';
  
  	insert into @NAMESPACE at .sl_seqlog
--- 3571,3575 ----
  	-- ----
  	execute 'select setval(''' || v_fqname ||
! 			''', ' || p_last_value::text || ')';
  
  	insert into @NAMESPACE at .sl_seqlog
***************
*** 3812,3816 ****
  			v_tab_fqname || ' for each row execute procedure @NAMESPACE at .logTrigger (' ||
                                 pg_catalog.quote_literal('_ at CLUSTERNAME@') || ',' || 
! 				pg_catalog.quote_literal(p_tab_id) || ',' || 
  				pg_catalog.quote_literal(v_tab_attkind) || ');';
  
--- 3812,3816 ----
  			v_tab_fqname || ' for each row execute procedure @NAMESPACE at .logTrigger (' ||
                                 pg_catalog.quote_literal('_ at CLUSTERNAME@') || ',' || 
! 				pg_catalog.quote_literal(p_tab_id::text) || ',' || 
  				pg_catalog.quote_literal(v_tab_attkind) || ');';
  
***************
*** 4037,4041 ****
  		-- ----
  		execute 'drop trigger "_ at CLUSTERNAME@_logtrigger_' || 
! 				p_tab_id || '" on ' || v_tab_fqname;
  	else
  		-- ----
--- 4037,4041 ----
  		-- ----
  		execute 'drop trigger "_ at CLUSTERNAME@_logtrigger_' || 
! 				p_tab_id::text || '" on ' || v_tab_fqname;
  	else
  		-- ----
***************
*** 4043,4047 ****
  		-- ----
  		execute 'drop trigger "_ at CLUSTERNAME@_denyaccess_' || 
! 				p_tab_id || '" on ' || v_tab_fqname;
  				
  		-- ----
--- 4043,4047 ----
  		-- ----
  		execute 'drop trigger "_ at CLUSTERNAME@_denyaccess_' || 
! 				p_tab_id::text || '" on ' || v_tab_fqname;
  				
  		-- ----
***************
*** 5384,5394 ****
  	-- Add missing indices...
  	for v_dummy in select distinct set_origin from @NAMESPACE at .sl_set loop
!             v_iname := 'PartInd_ at CLUSTERNAME@_sl_log_' || v_log || '-node-' || v_dummy.set_origin;
  	   -- raise notice 'Consider adding partial index % on sl_log_%', v_iname, v_log;
  	   -- raise notice 'schema: [_ at CLUSTERNAME@] tablename:[sl_log_%]', v_log;
!             select * into v_dummy2 from pg_catalog.pg_indexes where tablename = 'sl_log_' || v_log and  indexname = v_iname;
              if not found then
  		-- raise notice 'index was not found - add it!';
!         v_iname := 'PartInd_ at CLUSTERNAME@_sl_log_' || v_log || '-node-' || v_dummy.set_origin;
  		v_ilen := pg_catalog.length(v_iname);
  		v_maxlen := pg_catalog.current_setting('max_identifier_length'::text)::int4;
--- 5384,5394 ----
  	-- Add missing indices...
  	for v_dummy in select distinct set_origin from @NAMESPACE at .sl_set loop
!             v_iname := 'PartInd_ at CLUSTERNAME@_sl_log_' || v_log::text || '-node-' || v_dummy.set_origin;
  	   -- raise notice 'Consider adding partial index % on sl_log_%', v_iname, v_log;
  	   -- raise notice 'schema: [_ at CLUSTERNAME@] tablename:[sl_log_%]', v_log;
!             select * into v_dummy2 from pg_catalog.pg_indexes where tablename = 'sl_log_' || v_log::text and  indexname = v_iname;
              if not found then
  		-- raise notice 'index was not found - add it!';
!         v_iname := 'PartInd_ at CLUSTERNAME@_sl_log_' || v_log::text || '-node-' || v_dummy.set_origin;
  		v_ilen := pg_catalog.length(v_iname);
  		v_maxlen := pg_catalog.current_setting('max_identifier_length'::text)::int4;
***************
*** 5398,5402 ****
  
  		idef := 'create index "' || v_iname || 
!                         '" on @NAMESPACE at .sl_log_' || v_log || ' USING btree(log_txid) where (log_origin = ' || v_dummy.set_origin || ');';
  		execute idef;
  		v_count := v_count + 1;
--- 5398,5402 ----
  
  		idef := 'create index "' || v_iname || 
!                         '" on @NAMESPACE at .sl_log_' || v_log::text || ' USING btree(log_txid) where (log_origin = ' || v_dummy.set_origin::text || ');';
  		execute idef;
  		v_count := v_count + 1;
***************
*** 5407,5414 ****
  
  	-- Remove unneeded indices...
! 	for v_dummy in select indexname from pg_catalog.pg_indexes i where i.tablename = 'sl_log_' || v_log and
!                        i.indexname like ('PartInd_ at CLUSTERNAME@_sl_log_' || v_log || '-node-%') and
                         not exists (select 1 from @NAMESPACE at .sl_set where
! 				i.indexname = 'PartInd_ at CLUSTERNAME@_sl_log_' || v_log || '-node-' || set_origin)
  	loop
  		-- raise notice 'Dropping obsolete index %d', v_dummy.indexname;
--- 5407,5414 ----
  
  	-- Remove unneeded indices...
! 	for v_dummy in select indexname from pg_catalog.pg_indexes i where i.tablename = 'sl_log_' || v_log::text and
!                        i.indexname like ('PartInd_ at CLUSTERNAME@_sl_log_' || v_log::text || '-node-%') and
                         not exists (select 1 from @NAMESPACE at .sl_set where
! 				i.indexname = 'PartInd_ at CLUSTERNAME@_sl_log_' || v_log::text || '-node-' || set_origin::text)
  	loop
  		-- raise notice 'Dropping obsolete index %d', v_dummy.indexname;



More information about the Slony1-commit mailing list