Thread: Escape handling in strings
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". A summary of the plan is at: http://candle.pha.pa.us/cgi-bin/pgescape Therefore, I will soon apply the escape patch at: ftp://candle.pha.pa.us/pub/postgresql/mypatches/escape I will also backpatch the E'' syntax and read-only GUC variables to earlier releases. -- 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
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? Ed
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