Re: massive quotes?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Jon Jensen <jon(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: massive quotes?
Date: 2003-09-12 01:58:44
Message-ID: 5326.1063331924@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> ... You are saying it is safer to
> make it at the beginnning of a line _and_ have it be something that
> isn't used in SQL, but $$ is used in Perl, so I don't see the big
> advantage either way --- once you say X has to begin at the beginning of
> the line, we are already making things breakable by a newline, no?

Keep in mind that we have two different requirements: the quote start
marker has to be recognizable while we are parsing SQL (or possibly
plpgsql) code. The quote end marker has to be recognizable while we are
scanning text that could be almost anything.

The cute thing about the here-document solution to this problem is that
you can choose the quote end marker on a case-by-case basis. So you can
always pick something that won't conflict with anything that's actually
in the text you need to quote.

If we try to go with fixed markers (like {' ... }' and some other ideas
that were floated today), then we lose that flexibility, and we're up
against the losing game of trying to pick an end-marker that won't cause
problems in any programming language anywhere (not to mention possible
uses of the quoting mechanism for arbitrary string literals that aren't
even function bodies).

I'm not wedded to the "$$FOO" idea in particular, but I do think we want
to go with a solution that allows a variable end-marker.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-09-12 02:11:07 Re: [HACKERS] Win32 native port
Previous Message Bruce Momjian 2003-09-12 01:43:16 Reorganization of spinlock defines