pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedUnwanted nested dollar-quoted constants
2+ messages / 2 participants
[nested] [flat]
* Unwanted nested dollar-quoted constants
@ 2005-08-20 19:27 Bernard Henry Voynet <bhv@quebecemail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Bernard Henry Voynet @ 2005-08-20 19:27 UTC (permalink / raw)
To: pgsql-sql
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.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Unwanted nested dollar-quoted constants
@ 2005-08-27 14:56 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bernard Henry Voynet <bhv@quebecemail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2005-08-27 14:56 UTC (permalink / raw)
To: bhv@quebecemail.com; +Cc: pgsql-sql
Bernard Henry Voynet <bhv@quebecemail.com> 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-08-27 14:56 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-08-20 19:27 Unwanted nested dollar-quoted constants Bernard Henry Voynet <bhv@quebecemail.com>
2005-08-27 14:56 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox