Ian Burrell ianburrell
Thu Jun 30 16:47:37 PDT 2005
I didn't see any response to the bug I found with slon truncating
strings with UTF-8 characters in them.  The truncated strings were
being written to the sl_log_1 table.  This was causing the SYNC to
fail on the slave because of constraints violations.  It was also
corrupting data.  The slon_quote_literal shortens the copied string by
one byte for every multi-byte character.

 - Ian


--- src/backend/slony1_funcs.c  9 Jun 2005 15:02:15 -0000       1.33
+++ src/backend/slony1_funcs.c  28 Jun 2005 18:46:17 -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