Home > Archive > Slony1 PostgreSQL Replication > June 2005 > slon_quote_literal truncates UTF-8 strings









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author slon_quote_literal truncates UTF-8 strings
Ian Burrell

2005-06-27, 8:24 pm

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 =3D result;

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

*cp2++ =3D '\'';
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com