Ian Burrell ianburrell
Tue Jun 28 00:17:50 PDT 2005
I found the cause of the bug with strings with UTF-8 characters losing
one character in the sl_log_1.  The problem is in the
slon_quote_literal function.  This looks like it was copied from the
postgresql 7.4 source.  But there was one change to where
'len--' is done which causes this problem.  I have appended the patch
which fixes the problem.

 - Ian

--- src/backend/slony1_funcs.c  9 Jun 2005 15:02:15 -0000       1.33
+++ src/backend/slony1_funcs.c  27 Jun 2005 23:15:56 -0000
@@ -1104,7 +1104,7 @@
        cp2 = result;

        *cp2++ = '\'';
-       while (len-- > 0)
+       while (len > 0)
        {
                if ((wl = pg_mblen((unsigned char *)cp1)) != 1)
                {
@@ -1120,6 +1120,8 @@
                if (*cp1 == '\\')
                        *cp2++ = '\\';
                *cp2++ = *cp1++;
+
+               len--;
        }

        *cp2++ = '\'';


More information about the Slony1-general mailing list