The syntax needed for defining functions is quite annoying because of the
needed quoting. Example:

CREATE FUNCTION bla (int4) RETURNS char AS '
        BEGIN
                RETURN ''Two quotes needed''
        END;
' LANGUAGE 'plpgsql';
        
How about allowing something like in shell here-documents:
        
CREATE FUNCTION bla (int4) RETURNS char LANGUAGE 'plpgsql' UNTIL '__EOF__';
        BEGIN
                RETURN 'Only one quote needed'
        END;
__EOF__

Or similar. The __EOF__ is of course totally arbitrary and every string can
be used, so this will work with any language used.

jochen

Sat, 28 Aug 1999 17:27:46 -0400 (EDT)
pgsql-hackers@mail.remote.org
Quoting in stored procedures
pgsql-hackers@mail.remote.org writes:
> The syntax needed for defining functions is quite annoying because of the
> needed quoting.

Actually, considering that you probably don't want to be typing (and
retyping) procedure definitions right into psql, it seems to me that
what's really wanted is a procedure editor.  Once you've got that,
it could mask annoying little details like doubling quotes.

Another thing that I'd like to see along these same lines is an "UPDATE
FUNCTION" command that allows the stored text for a PL function
definition to be replaced, without dropping/recreating the function
definition.  Drop/recreate changes the function OID, thereby breaking
triggers that use it, and is generally a real pain when you're trying
to debug a bit of plpgsql...

			regards, tom lane

Sat, 28 Aug 1999 20:54:23 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Quoting in stored procedures 