Re: massive quotes?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>, Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: massive quotes?
Date: 2003-09-11 09:20:35
Message-ID: 200309111020.35045.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Pflug 2003-09-11 09:40:44 Re: massive quotes?
Previous Message Andreas Pflug 2003-09-11 08:37:30 Re: massive quotes?