7.2 request: other quoting mechanism for PLs?

From: Joel Burton <jburton(at)scw(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: 7.2 request: other quoting mechanism for PLs?
Date: 2001-04-23 04:41:04
Message-ID: Pine.LNX.4.21.0104230035460.15933-100000@olympus.scw.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


At

http://postgresql.readysetnet.com/devel-corner/docs/postgres/plpgsql-examples.html

the documentation reads

"""
One painful detail in writing functions in PL/pgSQL is the handling of
single quotes. The function's source text on CREATE FUNCTION must be a
literal string. Single quotes inside of literal strings must be either
doubled or quoted with a backslash. We are still looking for an elegant
alternative. In the meantime, doubling the single quotes as in the
examples below should be used. Any solution for this in future versions of
Postgres will be forward compatible.
"""

Is someone working on this?

Would it be possible to allow a different quoting character to be used for
the entire function (like the backticks), so that, if this
is used, quotes do not have to be doubled?

Then messy things like

CREATE function foo($1) returns text AS `select coalesce(''this is '' ||
$1, '''')` language 'sql';

could just be

CREATE FUNCTION foo($1) returns text AS `select coalesce('this is' || $1),
'')` language 'sql';

(or, if people are cautious about that, it could be double-backticks, or
triple-backticks-followed-by-six-carets, or *whatever* -- almost anything
seems less gooey that doubling quotes, *especially* when writing functions
that contain EXECUTE statements, so that everything must be quadrupled!)

If this isn't a good idea, what is?

Thanks!

--
Joel Burton <jburton(at)scw(dot)org>
Director of Information Systems, Support Center of Washington

Browse pgsql-general by date

  From Date Subject
Next Message Joel Burton 2001-04-23 05:00:30 Re: max. size for a table
Previous Message Joel Burton 2001-04-23 02:06:31 Re: CAST doesn't work :-( (fwd)