Thu Apr 23 10:21:21 PDT 2009
- Previous message: [Slony1-general] hyphen in slony cluster names
- Next message: [Slony1-general] slon segmentation fault.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Mark Hagger wrote: > Although preventing anyone getting into the state I got into must be a > good thing, even if it does feel quite evil. > > Actually, there's a clean way... I think something's buggy about this, because a test didn't complain, but the approach is clean enough... There *is* a suitable "hook" - we just add in a function that runs when functions are being loaded into the new node. The function can throw itself away afterwards, so we're not even leaving cruft in the database. :-) Index: backend/slony1_funcs.sql =================================================================== RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v retrieving revision 1.145.2.8 diff -c -u -r1.145.2.8 slony1_funcs.sql cvs diff: conflicting specifications of output style --- backend/slony1_funcs.sql 6 Apr 2009 22:33:04 -0000 1.145.2.8 +++ backend/slony1_funcs.sql 23 Apr 2009 17:18:15 -0000 @@ -198,6 +198,32 @@ 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 ~ '^(0|1|2|3|4|5|6|7|8|9)' then + raise exception 'Cluster name % starts with 0-9 - not a valid SQL symbol!', c_cluster; + end if; + if c_cluster like '%-%' then + raise exception 'Cluster name % contains "-" - not a valid SQL symbol!', c_cluster; + end if; +end +$$ language plpgsql; + +select @NAMESPACE at .check_namespace_validity(); +drop function @NAMESPACE at .check_namespace_validity(); + -- ---------------------------------------------------------------------- -- FUNCTION logTrigger () -- -- (reverse (concatenate 'string "ofni.sailifa.ac" "@" "enworbbc")) <http://dba2.int.libertyrms.com/> Christopher Browne (416) 673-4124 (land) "Bother," said Pooh, "Eeyore, ready two photon torpedoes and lock phasers on the Heffalump, Piglet, meet me in transporter room three"
- Previous message: [Slony1-general] hyphen in slony cluster names
- Next message: [Slony1-general] slon segmentation fault.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list