#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
#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
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;
/*@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;
/*
- * _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
*
*/
Datum
-_Slony_I_getLocalNodeId(PG_FUNCTION_ARGS)
+versionFunc(getLocalNodeId)(PG_FUNCTION_ARGS)
{
Slony_I_ClusterStatus *cs;
int rc;
/*
- * _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;
Datum
-_Slony_I_logTrigger(PG_FUNCTION_ARGS)
+versionFunc(logTrigger)(PG_FUNCTION_ARGS)
{
TransactionId newXid = GetTopTransactionId();
Slony_I_ClusterStatus *cs;
Datum
-_Slony_I_denyAccess(PG_FUNCTION_ARGS)
+versionFunc(denyAccess)(PG_FUNCTION_ARGS)
{
TriggerData *tg;
Datum
-_Slony_I_logApply(PG_FUNCTION_ARGS)
+versionFunc(logApply)(PG_FUNCTION_ARGS)
{
TransactionId newXid = GetTopTransactionId();
Slony_I_ClusterStatus *cs;
#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
/*
- * _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;
/*
- * _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];
Datum
-_Slony_I_lockedSet(PG_FUNCTION_ARGS)
+versionFunc(lockedSet)(PG_FUNCTION_ARGS)
{
TriggerData *tg;
Datum
-_Slony_I_killBackend(PG_FUNCTION_ARGS)
+versionFunc(killBackend)(PG_FUNCTION_ARGS)
{
int32 pid;
int32 signo;
}
Datum
-_Slony_I_seqtrack(PG_FUNCTION_ARGS)
+versionFunc(seqtrack)(PG_FUNCTION_ARGS)
{
static AVLtree seqmem = AVL_INITIALIZER(seqtrack_cmp, seqtrack_free);
AVLnode *node;
* 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;
* value.
*/
Datum
-_Slony_I_resetSession(PG_FUNCTION_ARGS)
+versionFunc(resetSession)(PG_FUNCTION_ARGS)
{
Slony_I_ClusterStatus *cs;
* argument.
*/
Datum
-_slon_decode_tgargs(PG_FUNCTION_ARGS)
+versionFunc(slon_decode_tgargs)(PG_FUNCTION_ARGS)
{
const char *arg;
size_t elem_size = 0;
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
-- ----------------------------------------------------------------------
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;
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;
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;
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;
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;
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;
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;
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;
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;
-- ----------------------------------------------------------------------
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;
-- ----------------------------------------------------------------------
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
--
-- ----------------------------------------------------------------------
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;
-- 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;
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;
-- ----------------------------------------------------------------------
-- 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;
-- ----------------------------------------------------------------------
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;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
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;
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';
--
-- ----------------------------------------------------------------------
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;
--
-- ----------------------------------------------------------------------
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
--
-- ----------------------------------------------------------------------
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
char rex2[257];
char rex3[257];
char rex4[257];
+ char rex5[257];
FILE *stmtp;
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);
}