Re: massive quotes? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: massive quotes?
Date
Msg-id 200308301542.h7UFgj707310@candle.pha.pa.us
Whole thread Raw
In response to Re: massive quotes?  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: massive quotes?
Re: massive quotes?
Re: massive quotes?
List pgsql-hackers
Is there a TODO here?  The only problem I see is that it introduces the
idea of special column-1 handling, which we don't have right now, except
in COPY.

---------------------------------------------------------------------------

Andrew Dunstan wrote:
> Jon Jensen wrote:
> 
> >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
> >  
> >
> 
> Nice idea. I would probably never have thought of it :-) Makes function 
> text almost first class, in the way that Oracle's is AFAICS,
> 
> I also prefer the first version, not least because it hoists the 
> LANGUAGE clause to the top where it seems to me it belongs.
> 
> I have no idea how hard this would be.
> 
> 
> cheers
> 
> andrew
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Jonathan Gardner
Date:
Subject: ALTER TABLE ... TO ... to change related names
Next
From: Bruce Momjian
Date:
Subject: Re: Bumping block size to 16K on FreeBSD...