7.2 request: other quoting mechanism for PLs?

Поиск
Список
Период
Сортировка
От Joel Burton
Тема 7.2 request: other quoting mechanism for PLs?
Дата
Msg-id Pine.LNX.4.21.0104230035460.15933-100000@olympus.scw.org
обсуждение исходный текст
Список 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@scw.org>
Director of Information Systems, Support Center of Washington


В списке pgsql-general по дате отправления:

Предыдущее
От: Joel Burton
Дата:
Сообщение: Re: max. size for a table
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Sourceforge PG crash