Christopher Browne cbbrowne
Fri Jul 14 06:57:00 PDT 2006
Stefan Kaltenbrunner wrote:
> Jan Wieck wrote:
>   
>> On 7/11/2006 12:43 PM, Christopher Browne wrote:
>>
>>     
>>> I have set up tarballs for a first release candidate; Jan should be
>>> uploading those soon, and I'll see about updating the web site when they
>>> are uploaded...
>>>       
>> I have run them through a compile and a few tests and uploaded them to 
>> the usual location at
>>
>> http://developer.postgresql.org/~wieck/slony1/download/
>>
>> One thing I wanted to discuss is related to a recent discussion on the 
>> hackers mailing list with respect to possible btree corruption due to 
>> xxid not being suitable. With a single origin setup, there is not 
>> problem during normal operation. But even then, any failover of move set 
>> could immediately cause the btree on the xid only (not the one on 
>> node-id, xid) to corrupt. I remember that this index was added because 
>> of the backend failure to use the one with the node-id. But that IMO 
>> doesn't warrant the risk of corrupting the index at the very time there 
>> is already trouble in the house (move set or failover isn't done because 
>> it is such a boring day).
>>     
>
> there is another issue with the current code - while it compiles and
> works fine against postgresql -HEAD with standards_conforming_strings =
> off(the default) it will silently corrupt data with
> standards_conforming_strings = on.
> The reason for this is the rather ad-hoc quoting in slon_quote_literal()
> - it will for example double-escape '\\' in strings leading to
> regression failures with for example testddl.
> Maybe we should take a look at the new escaping functions in the recent
> postgresql releases to make that more safe and future proof ?
>   
Looking at src/include/c.h, it looks as though escape_backslash may be a
backend control for this...

/*
 * Support macros for escaping strings.  escape_backslash should be TRUE
 * if generating a non-standard-conforming string.  Prefixing a string
 * with ESCAPE_STRING_SYNTAX guarantees it is non-standard-conforming.
 * Beware of multiple evaluation of the "ch" argument!
 */
#define SQL_STR_DOUBLE(ch, escape_backslash)^I\
^I((ch) == '\'' || ((ch) == '\\' && (escape_backslash)))

#define ESCAPE_STRING_SYNTAX^I'E'

Is it possible that the resolution is to wrap Slony-I "quoted stuff
submission" code with:

int OldEsc;
OldEsc = escape_backslash;
escape_backslash = TRUE;
[do bunch of stuff]
escape_backslash = OldEsc;
????

That is the same sort of logic now used with DateStyle (where we keep
the old value, and while writing dates, set it to the ISO conformant
form...).



More information about the Slony1-general mailing list