Joe Conway <m...@joeconway.com> writes:
> OK, got it. I think the attached is what you're looking for, although I 
> have not yet tested beyond "it compiles" and "it passes make installcheck".

You're making it vastly overcomplicated.  Just do something like

        for (cp = str; *cp; cp++)
        {
                if (*cp == '\\' || *cp == '\'')
                        AppendStringInfoChar(buf, '\\');
                AppendStringInfoChar(buf, *cp);
        }

Since you're working in a server-safe encoding, there is no need to
worry about multibyte characters --- the tests will never match
any byte of a multibyte char.

                        regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to