versioning all symbols in the shared library.
authorSteve Singer <ssinger@ca.afilias.info>
Fri, 31 May 2013 22:17:41 +0000 (18:17 -0400)
committerSteve Singer <ssinger@ca.afilias.info>
Fri, 31 May 2013 22:17:41 +0000 (18:17 -0400)
Slony 2.2 allows multiple versions of the shared library to be exist
on the filesystem($libdir) at once.  This means they can be loaded
into the same backend at once, but we need to ensure that the
exported symbols are unique

config.h.in
config_msvc.h
src/backend/slony1_funcs.c
src/backend/slony1_funcs.def
src/backend/slony1_funcs.sql
src/slonik/slonik.c

index 46e00b6739107f0dafaa73696bc6c5c540cc7a0e..76358b992a728284e9f7557e553f7bc0bec87862 100644 (file)
@@ -14,6 +14,7 @@
 
 #define SLONY_I_VERSION_STRING "2.2.0.b3"
 #define SLONY_I_VERSION_STRING_DEC 2,2,0,b3
+#define SLONY_I_FUNC_VERSION_STRING 2_2_0_b3
 
 #ifndef PG_VERSION_MAJOR
 #define PG_VERSION_MAJOR 0
index 9cf63b46f928d95ebf25b6e8dc5edeee3a3cd05b..0040059321a90bd83258bfa4b6e98e1840bfabba 100644 (file)
@@ -6,6 +6,7 @@
 
 #define SLONY_I_VERSION_STRING "2.2.0.b1"
 #define SLONY_I_VERSION_STRING_DEC 2,2,0,b1
+#define SLONY_I_FUNC_VERSION_STRING 2_2_0_b1
 #if PG_VERSION_NUM >= 90200
 #define HAVE_GETACTIVESNAPSHOT 1
 #define HAVE_TYPCACHE 1
index 232998b2cad14fbe0c373e03ebd5ab5b6bca122b..64c17855eb19d5ea782cd02ab8a6735968a1aa4c 100644 (file)
 PG_MODULE_MAGIC;
 #endif
 
-PG_FUNCTION_INFO_V1(_Slony_I_createEvent);
-PG_FUNCTION_INFO_V1(_Slony_I_getLocalNodeId);
-PG_FUNCTION_INFO_V1(_Slony_I_getModuleVersion);
-
-PG_FUNCTION_INFO_V1(_Slony_I_logTrigger);
-PG_FUNCTION_INFO_V1(_Slony_I_denyAccess);
-PG_FUNCTION_INFO_V1(_Slony_I_logApply);
-PG_FUNCTION_INFO_V1(_Slony_I_logApplySetCacheSize);
-PG_FUNCTION_INFO_V1(_Slony_I_logApplySaveStats);
-PG_FUNCTION_INFO_V1(_Slony_I_lockedSet);
-PG_FUNCTION_INFO_V1(_Slony_I_killBackend);
-PG_FUNCTION_INFO_V1(_Slony_I_seqtrack);
-
-PG_FUNCTION_INFO_V1(_slon_quote_ident);
-PG_FUNCTION_INFO_V1(_Slony_I_resetSession);
-PG_FUNCTION_INFO_V1(_slon_decode_tgargs);
-
-Datum          _Slony_I_createEvent(PG_FUNCTION_ARGS);
-Datum          _Slony_I_getLocalNodeId(PG_FUNCTION_ARGS);
-Datum          _Slony_I_getModuleVersion(PG_FUNCTION_ARGS);
-
-Datum          _Slony_I_logTrigger(PG_FUNCTION_ARGS);
-Datum          _Slony_I_denyAccess(PG_FUNCTION_ARGS);
-Datum          _Slony_I_logApply(PG_FUNCTION_ARGS);
-Datum          _Slony_I_logApplySetCacheSize(PG_FUNCTION_ARGS);
-Datum          _Slony_I_logApplySaveStats(PG_FUNCTION_ARGS);
-Datum          _Slony_I_lockedSet(PG_FUNCTION_ARGS);
-Datum          _Slony_I_killBackend(PG_FUNCTION_ARGS);
-Datum          _Slony_I_seqtrack(PG_FUNCTION_ARGS);
-
-Datum          _slon_quote_ident(PG_FUNCTION_ARGS);
-Datum          _slon_decode_tgargs(PG_FUNCTION_ARGS);
-
-Datum          _Slony_I_resetSession(PG_FUNCTION_ARGS);
+#define FOO 1
+
+#define versionFunc3(funcName,version) _Slony_I_## version##_##funcName
+#define versionFunc2(funcName,version) versionFunc3(funcName,version)
+#define versionFunc(funcName) versionFunc2(funcName,SLONY_I_FUNC_VERSION_STRING)
+
+PG_FUNCTION_INFO_V1(versionFunc(createEvent));
+PG_FUNCTION_INFO_V1(versionFunc(getLocalNodeId));
+PG_FUNCTION_INFO_V1(versionFunc(getModuleVersion));
+
+PG_FUNCTION_INFO_V1(versionFunc(logTrigger));
+PG_FUNCTION_INFO_V1(versionFunc(denyAccess));
+PG_FUNCTION_INFO_V1(versionFunc(logApply));
+PG_FUNCTION_INFO_V1(versionFunc(logApplySetCacheSize));
+PG_FUNCTION_INFO_V1(versionFunc(logApplySaveStats));
+PG_FUNCTION_INFO_V1(versionFunc(lockedSet));
+PG_FUNCTION_INFO_V1(versionFunc(killBackend));
+PG_FUNCTION_INFO_V1(versionFunc(seqtrack));
+
+PG_FUNCTION_INFO_V1(versionFunc(slon_quote_ident));
+PG_FUNCTION_INFO_V1(versionFunc(resetSession));
+PG_FUNCTION_INFO_V1(versionFunc(slon_decode_tgargs));
+
+
+
+Datum          versionFunc(createEvent)(PG_FUNCTION_ARGS);
+Datum          versionFunc(getLocalNodeId)(PG_FUNCTION_ARGS);
+Datum          versionFunc(getModuleVersion)(PG_FUNCTION_ARGS);
+
+Datum          versionFunc(logTrigger)(PG_FUNCTION_ARGS);
+Datum          versionFunc(denyAccess)(PG_FUNCTION_ARGS);
+Datum          versionFunc(logApply)(PG_FUNCTION_ARGS);
+Datum          versionFunc(logApplySetCacheSize)(PG_FUNCTION_ARGS);
+Datum          versionFunc(logApplySaveStats)(PG_FUNCTION_ARGS);
+Datum          versionFunc(lockedSet)(PG_FUNCTION_ARGS);
+Datum          versionFunc(killBackend)(PG_FUNCTION_ARGS);
+Datum          versionFunc(seqtrack)(PG_FUNCTION_ARGS);
+
+Datum          versionFunc(slon_quote_ident)(PG_FUNCTION_ARGS);
+Datum          versionFunc(slon_decode_tgargs)(PG_FUNCTION_ARGS);
+
+Datum          versionFunc(resetSession)(PG_FUNCTION_ARGS);
 
 #ifdef CYGWIN
 extern DLLIMPORT Node *newNodeMacroHolder;
@@ -205,15 +213,14 @@ static int64 apply_num_evict;
 
 /*@null@*/
 static Slony_I_ClusterStatus *clusterStatusList = NULL;
-static Slony_I_ClusterStatus *
-getClusterStatus(Name cluster_name,
+static Slony_I_ClusterStatus * getClusterStatus(Name cluster_name,
                                 int need_plan_mask);
-static const char *slon_quote_identifier(const char *ident);
-static int prepareLogPlan(Slony_I_ClusterStatus * cs,
+static const char * slon_quote_identifier(const char *ident);
+static int  prepareLogPlan(Slony_I_ClusterStatus * cs,
                           int log_status);
 
 Datum
-_Slony_I_createEvent(PG_FUNCTION_ARGS)
+versionFunc(createEvent)(PG_FUNCTION_ARGS)
 {
        TransactionId newXid = GetTopTransactionId();
        Slony_I_ClusterStatus *cs;
@@ -311,7 +318,7 @@ _Slony_I_createEvent(PG_FUNCTION_ARGS)
 
 
 /*
- * _Slony_I_getLocalNodeId -
+ * versionFunc(getLocalNodeId) -
  *
  *       SQL callable wrapper for calling getLocalNodeId() in order
  *       to get the current setting of sequence sl_local_node_id with
@@ -319,7 +326,7 @@ _Slony_I_createEvent(PG_FUNCTION_ARGS)
  *
  */
 Datum
-_Slony_I_getLocalNodeId(PG_FUNCTION_ARGS)
+versionFunc(getLocalNodeId)(PG_FUNCTION_ARGS)
 {
        Slony_I_ClusterStatus *cs;
        int                     rc;
@@ -336,14 +343,14 @@ _Slony_I_getLocalNodeId(PG_FUNCTION_ARGS)
 
 
 /*
- * _Slony_I_getModuleVersion -
+ * versionFunc(getModuleVersion) -
  *
  *       SQL callable function to determine the version number
  *       of this shared object during the startup checks.
  *
  */
 Datum
-_Slony_I_getModuleVersion(PG_FUNCTION_ARGS)
+versionFunc(getModuleVersion)(PG_FUNCTION_ARGS)
 {
        text       *retval;
        int                     len;
@@ -359,7 +366,7 @@ _Slony_I_getModuleVersion(PG_FUNCTION_ARGS)
 
 
 Datum
-_Slony_I_logTrigger(PG_FUNCTION_ARGS)
+versionFunc(logTrigger)(PG_FUNCTION_ARGS)
 {
        TransactionId newXid = GetTopTransactionId();
        Slony_I_ClusterStatus *cs;
@@ -777,7 +784,7 @@ _Slony_I_logTrigger(PG_FUNCTION_ARGS)
 
 
 Datum
-_Slony_I_denyAccess(PG_FUNCTION_ARGS)
+versionFunc(denyAccess)(PG_FUNCTION_ARGS)
 {
        TriggerData *tg;
 
@@ -824,7 +831,7 @@ _Slony_I_denyAccess(PG_FUNCTION_ARGS)
 
 
 Datum
-_Slony_I_logApply(PG_FUNCTION_ARGS)
+versionFunc(logApply)(PG_FUNCTION_ARGS)
 {
        TransactionId newXid = GetTopTransactionId();
        Slony_I_ClusterStatus *cs;
@@ -1332,8 +1339,8 @@ _Slony_I_logApply(PG_FUNCTION_ARGS)
 #endif
                if (target_rel == NULL)
                        elog(ERROR, "Slony-I: cannot find table %s.%s in logApply()",
-                                slon_quote_identifier(nspname),
-                                slon_quote_identifier(relname));
+                            slon_quote_identifier(nspname),
+                            slon_quote_identifier(relname));
 
                /*
                 * Create the saved SPI plan for this query
@@ -1810,13 +1817,13 @@ _Slony_I_logApply(PG_FUNCTION_ARGS)
 
 
 /*
- * _Slony_I_logApplySetCacheSize()
+ * versionFunc(logApplySetCacheSize)()
  *
  *     Called by slon during startup to set the size of the log apply
  *     query cache according to the config parameter apply_cache_size.
  */
 Datum
-_Slony_I_logApplySetCacheSize(PG_FUNCTION_ARGS)
+versionFunc(logApplySetCacheSize)(PG_FUNCTION_ARGS)
 {
        int32           newSize;
        int32           oldSize = applyCacheSize;
@@ -1838,12 +1845,12 @@ _Slony_I_logApplySetCacheSize(PG_FUNCTION_ARGS)
 
 
 /*
- * _Slony_I_logApplySaveStats()
+ * versionFunc(logApplySaveStats)()
  *
  *     Save statistics at the end of SYNC processing.
  */
 Datum
-_Slony_I_logApplySaveStats(PG_FUNCTION_ARGS)
+versionFunc(logApplySaveStats)(PG_FUNCTION_ARGS)
 {
        Slony_I_ClusterStatus *cs;
        Datum           params[11];
@@ -1974,7 +1981,7 @@ applyQueryIncrease(void)
 
 
 Datum
-_Slony_I_lockedSet(PG_FUNCTION_ARGS)
+versionFunc(lockedSet)(PG_FUNCTION_ARGS)
 {
        TriggerData *tg;
 
@@ -2005,7 +2012,7 @@ _Slony_I_lockedSet(PG_FUNCTION_ARGS)
 
 
 Datum
-_Slony_I_killBackend(PG_FUNCTION_ARGS)
+versionFunc(killBackend)(PG_FUNCTION_ARGS)
 {
        int32           pid;
        int32           signo;
@@ -2059,7 +2066,7 @@ seqtrack_free(void *seq)
 }
 
 Datum
-_Slony_I_seqtrack(PG_FUNCTION_ARGS)
+versionFunc(seqtrack)(PG_FUNCTION_ARGS)
 {
        static AVLtree seqmem = AVL_INITIALIZER(seqtrack_cmp, seqtrack_free);
        AVLnode    *node;
@@ -2202,7 +2209,7 @@ slon_quote_identifier(const char *ident)
  * Version: pgsql/src/backend/utils/adt/quote.c,v 1.14.4.1 2005/03/21 16:29:31
  */
 Datum
-_slon_quote_ident(PG_FUNCTION_ARGS)
+versionFunc(slon_quote_ident)(PG_FUNCTION_ARGS)
 {
        text       *t = PG_GETARG_TEXT_P(0);
        text       *result;
@@ -2605,7 +2612,7 @@ prepareLogPlan(Slony_I_ClusterStatus * cs,
  * value.
  */
 Datum
-_Slony_I_resetSession(PG_FUNCTION_ARGS)
+versionFunc(resetSession)(PG_FUNCTION_ARGS)
 {
        Slony_I_ClusterStatus *cs;
 
@@ -2648,7 +2655,7 @@ _Slony_I_resetSession(PG_FUNCTION_ARGS)
  * argument.
  */
 Datum
-_slon_decode_tgargs(PG_FUNCTION_ARGS)
+versionFunc(slon_decode_tgargs)(PG_FUNCTION_ARGS)
 {
        const char *arg;
        size_t          elem_size = 0;
index 680c20eda015c8fedb943fb8b001131deba511d1..2f291d59295e8663632663fa39133c2e73b9db62 100644 (file)
@@ -1,14 +1,14 @@
 EXPORTS
-_Slony_I_createEvent
-_Slony_I_getModuleVersion
-_Slony_I_denyAccess
-_Slony_I_lockedSet
-_Slony_I_getLocalNodeId
-_Slony_I_killBackend
-_Slony_I_seqtrack
-_Slony_I_logTrigger
-_Slony_I_resetSession
-_Slony_I_logApply
-_Slony_I_logApplySetCacheSize
-_Slony_I_logApplySaveStats
-_slon_decode_tgargs
+_Slony_I_2_2_0_b3_createEvent
+_Slony_I_2_2_0_b3_getModuleVersion
+_Slony_I_2_2_0_b3_denyAccess
+_Slony_I_2_2_0_b3_lockedSet
+_Slony_I_2_2_0_b3_getLocalNodeId
+_Slony_I_2_2_0_b3_killBackend
+_Slony_I_2_2_0_b3_seqtrack
+_Slony_I_2_2_0_b3_logTrigger
+_Slony_I_2_2_0_b3_resetSession
+_Slony_I_2_2_0_b3_logApply
+_Slony_I_2_2_0_b3_logApplySetCacheSize
+_Slony_I_2_2_0_b3_logApplySaveStats
+_Slony_I_2_2_0_b3_slon_decode_tgargs
index 2518e79f2b2c986ebc46b465b57ab68b3b24a10e..27141fbfe547ea351b876ed9f0832d61ce5ab368 100644 (file)
@@ -21,7 +21,7 @@
 -- ----------------------------------------------------------------------
 create or replace function @NAMESPACE@.createEvent (p_cluster_name name, p_event_type text)
        returns bigint
-       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_createEvent'
+       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_createEvent'
        language C
        called on null input;
 
@@ -32,7 +32,7 @@ Create an sl_event entry';
 
 create or replace function @NAMESPACE@.createEvent (p_cluster_name name, p_event_type text, ev_data1 text) 
        returns bigint
-       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_createEvent'
+       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_createEvent'
        language C
        called on null input;
 
@@ -43,7 +43,7 @@ Create an sl_event entry';
 
 create or replace function @NAMESPACE@.createEvent (p_cluster_name name, p_event_type text, ev_data1 text, ev_data2 text)
        returns bigint
-       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_createEvent'
+       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_createEvent'
        language C
        called on null input;
 
@@ -54,7 +54,7 @@ Create an sl_event entry';
 
 create or replace function @NAMESPACE@.createEvent (p_cluster_name name, p_event_type text, ev_data1 text, ev_data2 text, ev_data3 text)
        returns bigint
-       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_createEvent'
+       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_createEvent'
        language C
        called on null input;
 
@@ -65,7 +65,7 @@ Create an sl_event entry';
 
 create or replace function @NAMESPACE@.createEvent (p_cluster_name name, p_event_type text, ev_data1 text, ev_data2 text, ev_data3 text, ev_data4 text)
        returns bigint
-       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_createEvent'
+       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_createEvent'
        language C
        called on null input;
 
@@ -76,7 +76,7 @@ Create an sl_event entry';
 
 create or replace function @NAMESPACE@.createEvent (p_cluster_name name, p_event_type text, ev_data1 text, ev_data2 text, ev_data3 text, ev_data4 text, ev_data5 text)
        returns bigint
-       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_createEvent'
+       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_createEvent'
        language C
        called on null input;
 
@@ -87,7 +87,7 @@ Create an sl_event entry';
 
 create or replace function @NAMESPACE@.createEvent (p_cluster_name name, p_event_type text, ev_data1 text, ev_data2 text, ev_data3 text, ev_data4 text, ev_data5 text, ev_data6 text)
        returns bigint
-       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_createEvent'
+       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_createEvent'
        language C
        called on null input;
 
@@ -98,7 +98,7 @@ Create an sl_event entry';
 
 create or replace function @NAMESPACE@.createEvent (p_cluster_name name, p_event_type text, ev_data1 text, ev_data2 text, ev_data3 text, ev_data4 text, ev_data5 text, ev_data6 text, ev_data7 text)
        returns bigint
-       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_createEvent'
+       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_createEvent'
        language C
        called on null input;
 
@@ -109,7 +109,7 @@ Create an sl_event entry';
 
 create or replace function @NAMESPACE@.createEvent (p_cluster_name name, p_event_type text, ev_data1 text, ev_data2 text, ev_data3 text, ev_data4 text, ev_data5 text, ev_data6 text, ev_data7 text, ev_data8 text)
        returns bigint
-       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_createEvent'
+       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_createEvent'
        language C
        called on null input;
 
@@ -126,7 +126,7 @@ Create an sl_event entry';
 -- ----------------------------------------------------------------------
 create or replace function @NAMESPACE@.denyAccess ()
        returns trigger
-       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_denyAccess'
+       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_denyAccess'
        language C
        security definer;
 
@@ -144,7 +144,7 @@ grant execute on function @NAMESPACE@.denyAccess () to public;
 -- ----------------------------------------------------------------------
 create or replace function @NAMESPACE@.lockedSet ()
        returns trigger
-       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_lockedSet'
+       as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_lockedSet'
        language C;
 
 comment on function @NAMESPACE@.lockedSet () is 
@@ -156,7 +156,7 @@ comment on function @NAMESPACE@.lockedSet () is
 --     
 -- ----------------------------------------------------------------------
 create or replace function @NAMESPACE@.getLocalNodeId (p_cluster name) returns int4
-    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_getLocalNodeId'
+    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_getLocalNodeId'
        language C
        security definer;
 grant execute on function @NAMESPACE@.getLocalNodeId (p_cluster name) to public;
@@ -171,7 +171,7 @@ comment on function @NAMESPACE@.getLocalNodeId (p_cluster name) is
 --     object.
 -- ----------------------------------------------------------------------
 create or replace function @NAMESPACE@.getModuleVersion () returns text
-    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_getModuleVersion'
+    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_getModuleVersion'
        language C
        security definer;
 grant execute on function @NAMESPACE@.getModuleVersion () to public;
@@ -181,7 +181,7 @@ comment on function @NAMESPACE@.getModuleVersion () is
 
 
 create or replace function @NAMESPACE@.resetSession() returns text
-          as '$libdir/slony1_funcs.@MODULEVERSION@','_Slony_I_resetSession'
+          as '$libdir/slony1_funcs.@MODULEVERSION@','_Slony_I_@FUNCVERSION@_resetSession'
           language C;
 
 -- ----------------------------------------------------------------------
@@ -191,7 +191,7 @@ create or replace function @NAMESPACE@.resetSession() returns text
 --     does the actual work of updating the user tables.
 -- ----------------------------------------------------------------------
 create or replace function @NAMESPACE@.logApply () returns trigger
-    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_logApply'
+    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_logApply'
        language C
        security definer;
 
@@ -203,7 +203,7 @@ create or replace function @NAMESPACE@.logApply () returns trigger
 -- ----------------------------------------------------------------------
 create or replace function @NAMESPACE@.logApplySetCacheSize (p_size int4) 
 returns int4
-    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_logApplySetCacheSize'
+    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_logApplySetCacheSize'
        language C;
 
 -- ----------------------------------------------------------------------
@@ -214,7 +214,7 @@ returns int4
 -- ----------------------------------------------------------------------
 create or replace function @NAMESPACE@.logApplySaveStats (p_cluster name, p_origin int4, p_duration interval) 
 returns int4
-    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_logApplySaveStats'
+    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_logApplySaveStats'
        language C;
 
 
@@ -238,7 +238,7 @@ schema/functions.';
 select @NAMESPACE@.checkmoduleversion();
 
 create or replace function @NAMESPACE@.decode_tgargs(bytea) returns text[] as 
-'$libdir/slony1_funcs.@MODULEVERSION@','_slon_decode_tgargs' language C security definer;
+'$libdir/slony1_funcs.@MODULEVERSION@','_Slony_I_@FUNCVERSION@_slon_decode_tgargs' language C security definer;
 
 comment on function @NAMESPACE@.decode_tgargs(bytea) is 
 'Translates the contents of pg_trigger.tgargs to an array of text arguments';
@@ -277,7 +277,7 @@ drop function @NAMESPACE@.check_namespace_validity();
 --     
 -- ----------------------------------------------------------------------
 create or replace function @NAMESPACE@.logTrigger () returns trigger
-    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_logTrigger'
+    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_logTrigger'
        language C
        security definer;
 
@@ -320,7 +320,7 @@ comment on function @NAMESPACE@.terminateNodeConnections (p_failed_node int4) is
 --     
 -- ----------------------------------------------------------------------
 create or replace function @NAMESPACE@.killBackend (p_pid int4, p_signame text) returns int4
-    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_killBackend'
+    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_killBackend'
        language C;
 
 comment on function @NAMESPACE@.killBackend(p_pid int4, p_signame text) is
@@ -332,7 +332,7 @@ comment on function @NAMESPACE@.killBackend(p_pid int4, p_signame text) is
 --     
 -- ----------------------------------------------------------------------
 create or replace function @NAMESPACE@.seqtrack (p_seqid int4, p_seqval int8) returns int8
-    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_seqtrack'
+    as '$libdir/slony1_funcs.@MODULEVERSION@', '_Slony_I_@FUNCVERSION@_seqtrack'
        strict language C;
 
 comment on function @NAMESPACE@.seqtrack(p_seqid int4, p_seqval int8) is
index 62973156291211b9f617ac8025ab12cd4441da82..45658772a58d5fec34fc6d535d5d095700a9585c 100644 (file)
@@ -1911,6 +1911,7 @@ load_sql_script(SlonikStmt * stmt, SlonikAdmInfo * adminfo, char *fname,...)
        char            rex2[257];
        char            rex3[257];
        char            rex4[257];
+       char            rex5[257];
        FILE       *stmtp;
 
 
@@ -1940,7 +1941,12 @@ load_sql_script(SlonikStmt * stmt, SlonikAdmInfo * adminfo, char *fname,...)
                rex3[0] = '\0';
                replace_token(rex3, rex1, "@CLUSTERNAME@", stmt->script->clustername);
                replace_token(rex4, rex3, "@MODULEVERSION@", SLONY_I_VERSION_STRING);
-               replace_token(buf, rex4, "@NAMESPACE@", rex2);
+#define EXPAND2(x) #x
+#define EXPAND(x) EXPAND2(x)
+               replace_token(rex5,rex4,  "@FUNCVERSION@" ,  EXPAND(SLONY_I_FUNC_VERSION_STRING));
+#undef EXPAND
+#undef EXPAND2
+               replace_token(buf, rex5, "@NAMESPACE@", rex2);
                rc = strlen(buf);
                dstring_nappend(&query, buf, rc);
        }