Chris Browne cbbrowne at lists.slony.info
Tue Apr 28 07:36:23 PDT 2009
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv27558/src/backend

Modified Files:
      Tag: REL_2_0_STABLE
	slony1_funcs.sql 
Log Message:
Add in an at-functions-load-time test which validates that the
cluster name is valid, to address a difference in behaviour between
slonik and pgAdminIII


Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.145.2.8
retrieving revision 1.145.2.9
diff -C2 -d -r1.145.2.8 -r1.145.2.9
*** slony1_funcs.sql	6 Apr 2009 22:33:04 -0000	1.145.2.8
--- slony1_funcs.sql	28 Apr 2009 14:36:21 -0000	1.145.2.9
***************
*** 199,202 ****
--- 199,228 ----
  select @NAMESPACE at .checkmoduleversion();
  
+ -----------------------------------------------------------------------
+ -- This function checks to see if the namespace name is valid.  
+ --
+ -- Apparently pgAdminIII does different validation than Slonik, and so
+ -- users that set up cluster names using pgAdminIII can get in trouble in
+ -- that they do not get around to needing Slonik until it is too
+ -- late...
+ -----------------------------------------------------------------------
+ 
+ create or replace function @NAMESPACE at .check_namespace_validity () returns boolean as $$
+ declare
+ 	c_cluster text;
+ begin
+ 	c_cluster := '@CLUSTERNAME@';
+ 	if c_cluster !~ E'^[[:alpha:]_\$][[:alnum:]_\$]{0,62}$' then
+ 		raise exception 'Cluster name % is not a valid SQL symbol!', c_cluster;
+ 	else
+ 		raise notice 'checked validity of cluster % namespace - OK!', c_cluster;
+ 	end if;
+ 	return 't';
+ end
+ $$ language plpgsql;
+ 
+ select @NAMESPACE at .check_namespace_validity();
+ drop function @NAMESPACE at .check_namespace_validity();
+ 
  -- ----------------------------------------------------------------------
  -- FUNCTION logTrigger ()
***************
*** 5822,5823 ****
--- 5848,5850 ----
  tab_idxname is optional - if NULL, then we use the primary key.
  This function looks up replication configuration via the parent table.';
+ 



More information about the Slony1-commit mailing list