Re: Escape handling in strings - Mailing list pgsql-general

From Bruce Momjian
Subject Re: Escape handling in strings
Date
Msg-id 200506212331.j5LNVcJ09444@candle.pha.pa.us
Whole thread Raw
In response to Re: Escape handling in strings  ("Ed L." <pgsql@bluepolka.net>)
List pgsql-general
Ed L. wrote:
> On Tuesday June 21 2005 12:49 pm, Bruce Momjian wrote:
> > I have received very few replies to my suggestion that we
> > implement E'' for escaped strings, so eventually, after a few
> > major releases, we can have '' treat backslashes literally
> > like the SQL standard requires.
> >
> > I assume this is because most people say, "yea, it is going to
> > be a pain, and yea, we should probably do it".
>
> I read the webpage, but its still a little muddy.  Can you
> clarify/summarize the class of applications, and which dumps
> starting with 7.2*, will fail on clusters with this patch unless
> they are modified?

Well, postgresql.conf controls the warnings, until perhaps 8.3 where a
backslash in a string becomes literal, and \n is treated as \ and n, and
\\ is treated as \ and \, and \' is treated as \ and the end of the
string, and the rest of the string is part of the query, which is really
bad.

So, move \' to '', and when you get to 8.3 you need to use E'' for
escapes.

Dumps from releases before 8.1 might have problems loading in the CREATE
statements, but the COPY format is the same as before.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: Roman Neuhauser
Date:
Subject: Re: Postfix/Maildrop and too many connections issues
Next
From: Gregory Youngblood
Date:
Subject: Re: Postfix/Maildrop and too many connections issues