From: | Jon Jensen <jon(at)endpoint(dot)com> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net>, Postgresql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: massive quotes? |
Date: | 2003-08-29 14:49:09 |
Message-ID: | Pine.LNX.4.50.0308291443510.1287-100000@louche.swelter.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 28 Aug 2003, Andrew Dunstan wrote:
> What is the state of things regarding having to use massive strings of
> quotes like this (taken from the 7.3 docs)?:
>
> a_output := a_output || '' if v_'' ||
> referrer_keys.kind || '' like ''''''''''
> || referrer_keys.key_string || ''''''''''
> then return '''''' || referrer_keys.referrer_type
> || ''''''; end if;'';
>
> This is truly ugly, IMNSHO. Perl has its q() construct - any chance of
> us doing something here?
>
> I'm prepared to put in effort to implement a solution if there is
> agreement on what the solution should be. Maybe some sort of magical
> operator/function?
I was thinking the most natural thing would be to use something similar to
COPY's stdin quoting:
CREATE FUNCTION bob() RETURNS INTEGER AS stdin LANGUAGE 'plpgsql';
BEGIN
...
END;
\.
Another possibility would be shell/Perl-style here documents, like this:
CREATE FUNCTION bob() RETURNS INTEGER AS <<EOF
BEGIN
...
END;
EOF
LANGUAGE 'plpgsql';
The former seems preferable since it uses a syntax PostgreSQL already
supports in another context.
Jon
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2003-08-29 15:20:18 | Re: massive quotes? |
Previous Message | Bruce Badger | 2003-08-29 14:37:46 | Re: FE/BE Protocol - Specific version |