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 ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html