Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> What I don't like about this scheme is that it requires mods on both the
>> backend and client sides, to solve a problem that could be solved as
>> well or better (and definitely more simply) on the client side alone.
> backend returns something saying, "I am in COPY FROM STDIN mode, pass
> all text to me until I say stop". If that's how it works, wouldn't psql
> work with no changes.
psql may indeed work with no changes, because it's too stupid to know
when you're defining a function, and so it would not be surprised to get
a Start Copy In back from a CREATE FUNCTION command. This would not be
true of nearly any other client that one might use to define a function.
pgAdmin and other GUI tools all have code that knows perfectly well when
they're defining a function, and it would take nontrivial surgery to
make them able to use a COPY-based function definition mode.
People seem to think that psql is a representative client. It isn't.
regards, tom lane