Re: massive quotes?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: massive quotes?
Дата
Msg-id 200309111020.35045.dev@archonet.com
обсуждение исходный текст
Ответ на Re: massive quotes?  (Andreas Pflug <pgadmin@pse-consulting.de>)
Ответы Re: massive quotes?  (Andreas Pflug <pgadmin@pse-consulting.de>)
Список pgsql-hackers
On Thursday 11 September 2003 09:33, Andreas Pflug wrote:
> *NO PARSING*
> The script must be stuffable into PQexec in total, backend does the rest.
>
> Again: not psql, but sql language itself must provide this.
>
> No out-of-band, because this would require splitting the script in pieces.

What's wrong with re-using the COPY FROM format?

CREATE FUNCTION foo(int4) RETURNS int4 BODY FROM stdin LANGUAGE 'plpgsql';
BEGIN RAISE NOTICE 'param %',$1; RETURN $1;
END;
\.

The only real change is that the body of your function comes after the 
LANGUAGE specification.

Obviously, this is a special case where we are only looking for one value, so 
suppress delimiters on \t and \n.

If that's not liked then something like Perl's qq[] quoting system, which we 
could use anywhere.

Since the options boil down to:
1. Add some syntax to the SQL parser
2. Rely on client capabilities
3. Add syntax to "privileged" client - psql

I'll volunteer to help out if people decide #1 is the answer. The only places 
this quoting seems to be a real issue are when defining functions, so the 
COPY FROM format above seems to be adequate.

Is there anywhere else people need to quote large blocks of text that will 
almost certainly contain other quotes?

--  Richard Huxton Archonet Ltd


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

Предыдущее
От: Andreas Pflug
Дата:
Сообщение: Re: massive quotes?
Следующее
От: Andreas Pflug
Дата:
Сообщение: Re: massive quotes?