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

Modified Files:
      Tag: REL_1_2_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.98.2.36
retrieving revision 1.98.2.37
diff -C2 -d -r1.98.2.36 -r1.98.2.37
*** slony1_funcs.sql	31 Jul 2009 19:16:27 -0000	1.98.2.36
--- slony1_funcs.sql	10 Aug 2009 15:34:43 -0000	1.98.2.37
***************
*** 445,451 ****
  as '
  begin
! 	return ''''	|| @NAMESPACE at .slonyVersionMajor() || ''.''
! 				|| @NAMESPACE at .slonyVersionMinor() || ''.''
! 				|| @NAMESPACE at .slonyVersionPatchlevel();
  end;
  ' language plpgsql;
--- 445,451 ----
  as '
  begin
! 	return ''''	|| @NAMESPACE at .slonyVersionMajor()::text || ''.''
! 				|| @NAMESPACE at .slonyVersionMinor()::text || ''.''
! 				|| @NAMESPACE at .slonyVersionPatchlevel()::text;
  end;
  ' language plpgsql;
***************
*** 2086,2090 ****
  	loop
  		execute ''drop trigger "_ at CLUSTERNAME@_lockedset_'' || 
! 				v_tab_row.tab_id || ''" on '' || v_tab_row.tab_fqname;
  	end loop;
  
--- 2086,2090 ----
  	loop
  		execute ''drop trigger "_ at CLUSTERNAME@_lockedset_'' || 
! 				v_tab_row.tab_id::text || ''" on '' || v_tab_row.tab_fqname;
  	end loop;
  
***************
*** 3513,3517 ****
  	-- ----
  	execute ''select setval('''''' || v_fqname ||
! 			'''''', '''''' || p_last_value || '''''')'';
  
  	insert into @NAMESPACE at .sl_seqlog
--- 3513,3517 ----
  	-- ----
  	execute ''select setval('''''' || v_fqname ||
! 			'''''', '''''' || p_last_value::text || '''''')'';
  
  	insert into @NAMESPACE at .sl_seqlog
***************
*** 3958,3965 ****
  		-- ----
  		execute ''create trigger "_ at CLUSTERNAME@_logtrigger_'' || 
! 				p_tab_id || ''" after insert or update or delete on '' ||
  				v_tab_fqname || '' for each row execute procedure
  				@NAMESPACE at .logTrigger (''''_ at CLUSTERNAME@'''', '''''' || 
! 					p_tab_id || '''''', '''''' || 
  					v_tab_attkind || '''''');'';
  	else
--- 3958,3965 ----
  		-- ----
  		execute ''create trigger "_ at CLUSTERNAME@_logtrigger_'' || 
! 				p_tab_id::text || ''" after insert or update or delete on '' ||
  				v_tab_fqname || '' for each row execute procedure
  				@NAMESPACE at .logTrigger (''''_ at CLUSTERNAME@'''', '''''' || 
! 					p_tab_id::text || '''''', '''''' || 
  					v_tab_attkind || '''''');'';
  	else
***************
*** 4033,4037 ****
  		-- ----
  		execute ''create trigger "_ at CLUSTERNAME@_denyaccess_'' || 
! 				p_tab_id || ''" before insert or update or delete on '' ||
  				v_tab_fqname || '' for each row execute procedure
  				@NAMESPACE at .denyAccess (''''_ at CLUSTERNAME@'''');'';
--- 4033,4037 ----
  		-- ----
  		execute ''create trigger "_ at CLUSTERNAME@_denyaccess_'' || 
! 				p_tab_id::text || ''" before insert or update or delete on '' ||
  				v_tab_fqname || '' for each row execute procedure
  				@NAMESPACE at .denyAccess (''''_ at CLUSTERNAME@'''');'';
***************
*** 4119,4123 ****
  		-- ----
  		execute ''drop trigger "_ at CLUSTERNAME@_logtrigger_'' || 
! 				p_tab_id || ''" on '' || v_tab_fqname;
  	else
  		-- ----
--- 4119,4123 ----
  		-- ----
  		execute ''drop trigger "_ at CLUSTERNAME@_logtrigger_'' || 
! 				p_tab_id::text || ''" on '' || v_tab_fqname;
  	else
  		-- ----
***************
*** 4125,4129 ****
  		-- ----
  		execute ''drop trigger "_ at CLUSTERNAME@_denyaccess_'' || 
! 				p_tab_id || ''" on '' || v_tab_fqname;
  				
  		-- ----
--- 4125,4129 ----
  		-- ----
  		execute ''drop trigger "_ at CLUSTERNAME@_denyaccess_'' || 
! 				p_tab_id::text || ''" on '' || v_tab_fqname;
  				
  		-- ----
***************
*** 5761,5772 ****
  	-- 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!'';
! 		idef := ''create index "PartInd_ at CLUSTERNAME@_sl_log_'' || v_log || ''-node-'' || v_dummy.set_origin ||
!                         ''" on @NAMESPACE at .sl_log_'' || v_log || '' USING btree(log_xid @NAMESPACE at .xxid_ops) where (log_origin = '' || v_dummy.set_origin || '');'';
  		execute idef;
  		v_count := v_count + 1;
--- 5761,5772 ----
  	-- 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::text;
  	    -- 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!'';
! 		idef := ''create index "PartInd_ at CLUSTERNAME@_sl_log_'' || v_log::text || ''-node-'' || v_dummy.set_origin::text ||
!                         ''" on @NAMESPACE at .sl_log_'' || v_log::text || '' USING btree(log_xid @NAMESPACE at .xxid_ops) where (log_origin = '' || v_dummy.set_origin::text || '');'';
  		execute idef;
  		v_count := v_count + 1;
***************
*** 5777,5784 ****
  
  	-- 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;
--- 5777,5784 ----
  
  	-- 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