Re: massive quotes? - Mailing list pgsql-hackers

From Richard Huxton
Subject Re: massive quotes?
Date
Msg-id 200309111020.35045.dev@archonet.com
Whole thread Raw
In response to Re: massive quotes?  (Andreas Pflug <pgadmin@pse-consulting.de>)
Responses Re: massive quotes?  (Andreas Pflug <pgadmin@pse-consulting.de>)
List 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 by date:

Previous
From: Andreas Pflug
Date:
Subject: Re: massive quotes?
Next
From: Andreas Pflug
Date:
Subject: Re: massive quotes?