From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, Postgresql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: massive quotes? |
Date: | 2003-09-01 00:47:41 |
Message-ID: | 200309010047.h810lfK20777@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> > In that case, though, the solution will presumably look at least a bit
> > different from those discussed so far in this thread. Or would you have
> > psql detect that in place of a string there was "stdin" or whatever and
> > then replace it with the inline string before passing it to the backend?
>
> Please see the archives. I think that what was being discussed was
> something along the lines of
>
> foo=> CREATE FUNCTION myfunc(...) RETURNS ... AS
> foo=> \beginliteral
> foo'> type my function definition here
> foo'> and here
> foo'> \endliteral
> foo-> LANGUAGE plpgsql;
>
> and psql would proceed to quotify whatever you entered between
> the two backslash commands. (Notice this could be used for any
> string-literal entry problem, not only CREATE FUNCTION.) I'm fuzzy on
> the details though; this may not have been the best idea presented.
Let me jump in --- there is the issue of how to prevent the backend from
running the query through the lexer/parser. The cleanest idea presented
was:
>CREATE FUNCTION bob() RETURNS INTEGER AS stdin LANGUAGE 'plpgsql';
>BEGIN
> ...
>END;
>\.
The interesting thing I missed at first viewing was that there is a
semicolon after the first line. This allows the backend to go into a
COPY-like mode where the client can pass lines to the backend bypassing
the lexer/parser.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2003-09-01 00:57:16 | Re: massive quotes? |
Previous Message | Tom Lane | 2003-09-01 00:25:24 | Re: massive quotes? |