Thread: Copy function syntax on 8.1
Hi, In testing 8.1 I turned on the escape_string_warning. Now when I issue a COPY FROM / TO 'C:\\test' I am getting the "nonstandard.." warning since file paths in Windows use the \ character. I can clear the warning by changing the syntaxto E'C:\\test'. Is their a way to properly escape the \ without using E or will the COPY function have to modified internally to not returna warning if a \ is passed in the file path? Mike
Mike G. wrote: > Hi, > > In testing 8.1 I turned on the escape_string_warning. Now when I issue > a COPY FROM / TO 'C:\\test' I am getting the "non standard.." warning > since file paths in Windows use the \ character. I can clear the > warning by changing the syntax to E'C:\\test'. > > Is their a way to properly escape the \ without using E or will the > COPY function have to modified internally to not return a warning if > a \ is passed in the file path? > The code is functioning exactly as described in the release notes, mainly you have to use E'' for backslashes in strings. COPY will not be modified to suppress those. It is working properly. -- 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
"Mike G." <mike@thegodshalls.com> writes: > In testing 8.1 I turned on the escape_string_warning. Now when I issue a COPY FROM / TO 'C:\\test' I am getting the "nonstandard.." warning since file paths in Windows use the \ character. I can clear the warning by changing the syntaxto E'C:\\test'. > Is their a way to properly escape the \ without using E or will the COPY function have to modified internally to not returna warning if a \ is passed in the file path? Why do you think COPY should be modified? This is exactly the case that the warning is intended to warn about. regards, tom lane
On the non windows platforms you can issue the copy statement and the file path syntax is exactly the same as if you werechanging directories in a shell. No special escaping or syntax is needed. It would be nice if the same could be done for those forced to use windows. In this case one does not really have a choice on whether or not they want to use special backslash processing. I have no problem using the E'' if it will be supported well into the future. It just is not as convenient. Mike On Tue, Aug 30, 2005 at 12:39:48PM -0400, Tom Lane wrote: > "Mike G." <mike@thegodshalls.com> writes: > > In testing 8.1 I turned on the escape_string_warning. Now when I issue a COPY FROM / TO 'C:\\test' I am getting the"non standard.." warning since file paths in Windows use the \ character. I can clear the warning by changing the syntaxto E'C:\\test'. > > > Is their a way to properly escape the \ without using E or will the COPY function have to modified internally to notreturn a warning if a \ is passed in the file path? > > Why do you think COPY should be modified? This is exactly the case that > the warning is intended to warn about. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly
"Mike G." <mike@thegodshalls.com> writes: > On the non windows platforms you can issue the copy statement and the file path syntax is exactly the same as if you werechanging directories in a shell. No special escaping or syntax is needed. > It would be nice if the same could be done for those forced to use windows. Well, that's one reason why we are migrating towards backslashes not being special in strings. It's going to take awhile to get there, though, because we can't just change it without a lot of advance notice. There are too many programs that would break. regards, tom lane
Thank you. Perhaps this should be added to the TODO list? New section specifically for issues related to this? Mike On Tue, Aug 30, 2005 at 01:54:56PM -0400, Tom Lane wrote: > "Mike G." <mike@thegodshalls.com> writes: > > On the non windows platforms you can issue the copy statement and the file path syntax is exactly the same as if youwere changing directories in a shell. No special escaping or syntax is needed. > > It would be nice if the same could be done for those forced to use windows. > > Well, that's one reason why we are migrating towards backslashes not > being special in strings. It's going to take awhile to get there, > though, because we can't just change it without a lot of advance notice. > There are too many programs that would break. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match
Mike G. wrote: > Thank you. > > Perhaps this should be added to the TODO list? New section specifically > for issues related to this? I think our current documentation/release notes are clear on this point. --------------------------------------------------------------------------- > > Mike > > On Tue, Aug 30, 2005 at 01:54:56PM -0400, Tom Lane wrote: > > "Mike G." <mike@thegodshalls.com> writes: > > > On the non windows platforms you can issue the copy statement and the file path syntax is exactly the same as if youwere changing directories in a shell. No special escaping or syntax is needed. > > > It would be nice if the same could be done for those forced to use windows. > > > > Well, that's one reason why we are migrating towards backslashes not > > being special in strings. It's going to take awhile to get there, > > though, because we can't just change it without a lot of advance notice. > > There are too many programs that would break. > > > > regards, tom lane > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 9: In versions below 8.0, the planner will ignore your desire to > > choose an index scan if your joining column's datatypes do not > > match > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > -- 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
Bruce Momjian <pgman@candle.pha.pa.us> writes: > Mike G. wrote: >> Perhaps this should be added to the TODO list? New section specifically >> for issues related to this? > I think our current documentation/release notes are clear on this point. He's got a point though --- stuff that we are intending to do over the next few releases probably ought to be carried in TODO. regards, tom lane
Tom Lane wrote: > Bruce Momjian <pgman@candle.pha.pa.us> writes: > > Mike G. wrote: > >> Perhaps this should be added to the TODO list? New section specifically > >> for issues related to this? > > > I think our current documentation/release notes are clear on this point. > > He's got a point though --- stuff that we are intending to do over the > next few releases probably ought to be carried in TODO. OK, that is easy. -- 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