Re: massive quotes?

From: Jon Jensen <jon(at)endpoint(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: massive quotes?
Date: 2003-09-11 19:56:09
Message-ID: Pine.LNX.4.58.0309111950010.7142@louche.swelter.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 11 Sep 2003, Tom Lane wrote:

> People seem to be assuming that this feature needs to be impervious to
> whitespace and being adjacent to other things. I believe we could make
> it a good deal more robust if both the opening and closing markers
> (whatever they are) are required to stand alone on a line. For example
>
> {'
> }'
>
> represents the empty string, and
>
> {'
> x = 'text';
> }'
>
> represents '\tx = \'text\';'. I think the rule would need to be that
> the newline just after the opening marker, and the newline just before
> the closing marker, are not included in the resulting string literal.
>
> The point is we don't have to make case like {'xxx}' be recognized as an
> occurrence of this construct, and on the whole I think it's a lot safer
> if we don't. Keep in mind that the string you are trying to quote is
> often code in a language that is not SQL. Therefore, choosing markers
> on the grounds that they won't appear in SQL is not good enough.

Agreed. But I think it would be very nice to not invent yet another block
quoting mechanism if possible. I don't understand the resistance to here
documents, since they solve the problem Tom brought up -- the token will
by definition never be a problem because it's alone on a line, and the
user chooses it and can avoid problematic ones. Or to combine COPY style
(but not its under-the-hood operation) with here documents, why not:

INSERT INTO sometable (5, <<\.
a
very long
string
\.
);

Is there a reason not to use here documents?

Jon

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-09-11 19:57:23 Re: Problem with function permission test in a view
Previous Message Tom Lane 2003-09-11 19:38:46 Re: massive quotes?