Skip to content

Commit

Permalink
Allow the apply trigger to work (ie not fail) on sl_log_script rows f…
Browse files Browse the repository at this point in the history
…rom earlier betas of 2.2.0
  • Loading branch information
ssinger committed Aug 1, 2013
1 parent 94521f9 commit ee5c881
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions src/backend/slony1_funcs.c
Expand Up @@ -1013,44 +1013,44 @@ versionFunc(logApply)(PG_FUNCTION_ARGS)
TEXTOID, -1, false, 'i',
&cmdargs, &cmdargsnulls, &cmdargsn);

if( cmdargsn < 3 )
{
elog(ERROR,"Slony-I: DDL_SCRIPT events require at least 3 elements"\
"in the argument array");
}

nodeargs=NULL;
nodeargsn=0;
delim_text=DirectFunctionCall1(textin,CStringGetDatum(","));
if ( (! cmdargsnulls[1]) )
{
char * astr=DatumGetCString(DirectFunctionCall1(textout,
cmdargs[1]));

if ( strcmp(astr,""))
{
array_holder = DirectFunctionCall2(text_to_array,cmdargs[1],
delim_text);
deconstruct_array(DatumGetArrayTypeP(array_holder),
TEXTOID, -1, false, 'i',
&nodeargs, &nodeargsnulls, &nodeargsn);
}
}
seqargs=NULL;
seqargsn=0;
if ( (! cmdargsnulls[2]) )
if( cmdargsn >= 2 )
{
char * astr=DatumGetCString(DirectFunctionCall1(textout,
cmdargs[2]));
if( strcmp(astr,"") )
{
array_holder = DirectFunctionCall2(text_to_array,cmdargs[2],
delim_text);
deconstruct_array(DatumGetArrayTypeP(array_holder),
TEXTARRAYOID, -1, false, 'i',
&seqargs, &seqargsnulls, &seqargsn);
delim_text=DirectFunctionCall1(textin,CStringGetDatum(","));
if ( (! cmdargsnulls[1]) )
{
char * astr=DatumGetCString(DirectFunctionCall1(textout,
cmdargs[1]));

if ( strcmp(astr,""))
{
array_holder = DirectFunctionCall2(text_to_array,cmdargs[1],
delim_text);
deconstruct_array(DatumGetArrayTypeP(array_holder),
TEXTOID, -1, false, 'i',
&nodeargs, &nodeargsnulls, &nodeargsn);
}
}
}
if(cmdargsn >= 3)
{
if ( (! cmdargsnulls[2]) )
{
char * astr=DatumGetCString(DirectFunctionCall1(textout,
cmdargs[2]));
if( strcmp(astr,"") )
{
array_holder = DirectFunctionCall2(text_to_array,cmdargs[2],
delim_text);
deconstruct_array(DatumGetArrayTypeP(array_holder),
TEXTARRAYOID, -1, false, 'i',
&seqargs, &seqargsnulls, &seqargsn);
}
}
}
/*
* The first element is the DDL statement itself.
*/
Expand Down

0 comments on commit ee5c881

Please sign in to comment.