Chris Browne cbbrowne at lists.slony.info
Tue Aug 11 07:49:33 PDT 2009
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv30262

Modified Files:
	slony1_funcs.sql 
Log Message:
Apply recent changes from 2.0 (casting to text, returning bigints) to HEAD


Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.151
retrieving revision 1.152
diff -C2 -d -r1.151 -r1.152
*** slony1_funcs.sql	28 Jul 2009 16:05:48 -0000	1.151
--- slony1_funcs.sql	11 Aug 2009 14:49:31 -0000	1.152
***************
*** 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
***************
*** 3645,3649 ****
  -- ----------------------------------------------------------------------
  create or replace function @NAMESPACE at .ddlScript_complete (int4, text, int4)
! returns integer
  as $$
  declare
--- 3645,3649 ----
  -- ----------------------------------------------------------------------
  create or replace function @NAMESPACE at .ddlScript_complete (int4, text, int4)
! returns bigint
  as $$
  declare
***************
*** 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;
  				
  		-- ----
***************
*** 4052,4056 ****
  				where tgrelid = v_tab_row.indexrelid;
  		get diagnostics v_n = row_count;
! 		if v_n > 0 then
  			update "pg_catalog".pg_class
  					set reltriggers = reltriggers + v_n
--- 4052,4056 ----
  				where tgrelid = v_tab_row.indexrelid;
  		get diagnostics v_n = row_count;
! 		if (v_n > 0) and exists (select 1 from information_schema.columns where table_name = 'pg_class' and table_schema = 'pg_catalog' and column_name = 'reltriggers') then
  			update "pg_catalog".pg_class
  					set reltriggers = reltriggers + v_n
***************
*** 5065,5069 ****
  -- ----------------------------------------------------------------------
  create or replace function @NAMESPACE at .updateReloid (int4, int4)
! returns int4
  as $$
  declare
--- 5065,5069 ----
  -- ----------------------------------------------------------------------
  create or replace function @NAMESPACE at .updateReloid (int4, int4)
! returns bigint
  as $$
  declare
***************
*** 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