Skip site navigation (1) Skip section navigation (2)

Re: massive quotes?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(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-08-30 21:25:59
Message-ID: 29697.1062278759@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Tom Lane wrote:
>> I think the idea would be to execute what's effectively a COPY IN during
>> the CREATE FUNCTION command, and then use the data so collected as the
>> function body.  It seems doable offhand, though we'd have to think about
>> whether this breaks any aspect of the FE/BE protocol, or whether it's
>> truly a user-friendly interface.

> Wow, imagine libpq creating a function.  Doesn't it just pass the
> entire string to the server?  How would COPY IN handle that?

I don't think libpq would know the difference.  It certainly has no idea
that a command that you send to the backend is a COPY --- it only finds
that out when the Start Copy In message comes back from the backend.
I believe the same is true of psql.  So if a CREATE FUNCTION command
were to issue Start Copy In, both those layers would happily cooperate
in passing through everything you type up to "\.".  Then we take that
pile of bits and use it as the function body string in the rest of
CREATE FUNCTION.  (None of this need have anything to do with the
existing commands/copy.c backend code, either, though some small part
of the code might be worth sharing.)

Other client libraries such as jdbc might need more surgery, though,
if they have more smarts about COPY than libpq does.

I'm also wondering why the backend need have anything at all to do with
an improved function-definition mode.  If you look in the archives you
will see speculation about inventing psql backslash commands that would
assist in entering raw function definitions by taking something you type
and suitably quotifying it.  This seems to me to be a cleaner and more
localized approach to getting much the same functionality.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2003-08-30 21:30:30
Subject: Re: SetVariable
Previous:From: Manfred SpraulDate: 2003-08-30 20:18:16
Subject: Re: Linux2.6 overcommit behaviour

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group