Bruce Momjian wrote:


Something that includes "'" would be clearest. I thought of <' and '>,
but this would break:


I'm not sure that using a quote is necessarily clearest. But it's a matter of taste. I had thought of {{ and }} as maybe working.

[snip]

One clean way would be to use {' to start a quote, and }' to end it, so
we have:


CREATE FUNCTION test() ... {' x = 'text'; }'

which looks even better and this is safe because both braces in '}text}'
are seen in a quoted string:

        CREATE FUNCTION test() ...
        {'
                x = '}text}';
        }'

Also, I can't imagine anyone defining those as operators.



Quite cute. I like it better than the here-document style.

Is this proposed as a general quoting mechanism, or only in the context of "create function"? (I favor a general mechanism, if that matters :-) - I got caught three times in the last 2 weeks with embedded quotes in "comment on" statements.)

cheers

andrew


---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to