Fri Nov 12 20:09:28 PST 2004
- Previous message: [Slony1-general] Re: [Slony1-commit] By cbbrowne: Add FUNCTION generate_sync_event () - to try to add SYNCs
- Next message: [Slony1-commit] By cbbrowne: Make "ducttape" scripts that use pgbench aware of varying
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message:
-----------
Add function upgrade_sl_node() that adds no_spool field to sl_node
This is probably the "model" for how things should be done at upgrade
time...
This function looks to see if the field needs to be added to the
data dictionary, and does so if necessary.
Modified Files:
--------------
slony1-engine/src/backend:
slony1_funcs.sql (r1.40 -> r1.41)
-------------- next part --------------
Index: slony1_funcs.sql
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.40
retrieving revision 1.41
diff -Lsrc/backend/slony1_funcs.sql -Lsrc/backend/slony1_funcs.sql -u -w -r1.40 -r1.41
--- src/backend/slony1_funcs.sql
+++ src/backend/slony1_funcs.sql
@@ -4634,6 +4634,28 @@
Checks if a table has our special serial key column that is used if
the table has no natural unique constraint.';
+create or replace function @NAMESPACE at .upgrade_sl_node () returns bool
+as '
+DECLARE
+ v_row record;
+BEGIN
+ select 1 into v_row
+ from pg_namespace n, pg_class c, pg_attribute a
+ where
+ n.nspname = ''@NAMESPACE@'' and
+ c.relnamespace = n.oid and
+ c.relname = ''sl_node'' and
+ a.attrelid = c.oid and
+ a.attname = ''no_spool'';
+ if not found then
+ raise notice ''Upgrade sl_node - add field no_spool'';
+ alter table @NAMESPACE at .sl_node
+ add column no_spool boolean default ''f'';
+ update @NAMESPACE at .sl_node set no_spool = ''f'';
+ return ''t'';
+ end if;
+ return ''f'';
+END;' language plpgsql;
-- ----------------------------------------------------------------------
-- VIEW sl_status
- Previous message: [Slony1-general] Re: [Slony1-commit] By cbbrowne: Add FUNCTION generate_sync_event () - to try to add SYNCs
- Next message: [Slony1-commit] By cbbrowne: Make "ducttape" scripts that use pgbench aware of varying
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list