Re: dollar quoting and pg_dump

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Postgresql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: dollar quoting and pg_dump
Date: 2004-03-23 15:28:16
Message-ID: 20521.1080055696@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> ... using it in dumping function bodies and comments on all objects,
> with a prefix argument of "function" and "comment" respectively. There
> might be other places where we want to use dollar quoting, but this
> would be a good start, ISTM.

Do we really need to be that verbose? Why not start with the minimal $$
and extend only if needed? On the KISS principle, trying "$$", "$X$",
"$XX$", "$XXX$", etc seems sufficient.

For that matter, I'm not convinced we should use $$ for comments. They
don't have nearly the problem that functions do with embedded quotes.

A thought: maybe just put this logic into the regular
appendStringLiteral routine, and trigger it when the string contains any
quotes or backslashes; if it has none, you can just use quotes ...

BTW, I've been holding off making this change myself, realizing that it
will completely break backwards compatibility of pg_dump output to 7.4
and earlier. Not sure if anyone is trying to use CVS tip pg_dump with
older releases, but it seems possible given that the dump ordering issue
is finally solved. Might be a good idea to make it disablable with a
fallback to regular quoting.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthew T. O'Connor 2004-03-23 15:45:17 Re: postgres on windows page update
Previous Message Andrew Dunstan 2004-03-23 15:08:54 dollar quoting and pg_dump

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-03-23 15:37:16 Re: pstrndup()
Previous Message Andrew Dunstan 2004-03-23 15:08:54 dollar quoting and pg_dump