Unwanted nested dollar-quoted constants
Unwanted nested dollar-quoted constants
От:
Bernard Henry Voynet <bhv@quebecemail.com>
Дата:
Hello, I recurrently need to migrate a big amount of data from one database type to PostgreSQL 8.0.3. For this, I use INSERT scripts that I run from the pgAdmin III. All the text fields are specified using the dollar-quoted string constant form that. However, sometime, there are records that include some text that look like a nested tagged dollar-quoted constant start (eg. $EN$) without its ending conterpart. In such situation, the whole set of records is refused (without any error telling where and what). I have tried to insert a '\' char in front of each '$' which, of course, did ot work since they are not treated as is. So, what can I do to say that it is not a start of a new nested tagged dollar-quoted constant ? Or is there any way to disable nested tagged dollar-quoted constant ? Best regards _____________________________________________________________ Obtenez aussi votre adresse electronique gratuite de Quebecemail.com http://www.quebecemail.com, un service gratuit et permanent.
Re: Unwanted nested dollar-quoted constants
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bernard Henry Voynet writes: > All the text fields are specified using the dollar-quoted string constant form that. This is your mistake to start with. You can not simply stick a couple of dollar signs around a random string and expect to have a valid literal, any more than you can stick a couple of quote marks around it and expect to have a valid literal. Dollar-quoting is not a magic bullet that will let you forget about escaping data. I would recommend going back to regular quoted literals and making sure you double any quotes or backslashes in the data. It's possible to develop appropriate code for dollar-quoting random text, but it's a lot harder than it is to escape the data in the old style. regards, tom lane