Re: Inline PL/pgSQL - Mailing list pgsql-hackers

From David Fetter
Subject Re: Inline PL/pgSQL
Date
Msg-id 20050510002635.GF2316@fetter.org
Whole thread Raw
In response to Re: Inline PL/pgSQL  ("Jonah H. Harris" <jharris@tvi.edu>)
List pgsql-hackers
On Mon, May 09, 2005 at 05:28:42PM -0600, Jonah H. Harris wrote:
> David,
> 
> I agree with your idea.  That seems like it would be somewhat easy to 
> implement and would do exactly what I would need.  Anyone else have 
> ideas or thoughts along this line?

Seeing as EXECUTE IMMEDIATE is already used, so how about PERFORM
IMMEDIATE?  I also like the idea of functions whose scope is settable.
Something like this:

CREATE [OR REPLACE] [ TRANSACTION | SESSION ] FUNCTION ...

Cheers,
D
> 
> David Fetter wrote:
> 
> >On Mon, May 09, 2005 at 11:44:23AM -0600, Jonah H. Harris wrote:
> > 
> >
> >>Hey everyone,
> >>
> >>In addition to package support in plpgsql, it would be really handy
> >>to have inline plpgsql.  Likewise, I think there are others who feel
> >>this way as-well.
> >>   
> >>
> >
> >Why yes, there are. :)
> >
> > 
> >
> >>Years ago, Oracle merged PL/SQL with their normal SQL parser which
> >>allowed for inline PL/SQL.  They did this because it was difficult
> >>to maintain two separate parsers.  While this worked great for
> >>Oracle, it probably wouldn't really work as well for PostgreSQL
> >>because pgsql supports multiple procedural languages.
> >>   
> >>
> >
> >I proposed a syntax for this awhile back.  I haven't found it in the
> >archives, but it goes like this:
> >
> >EXECUTE IMMEDIATE $$
> >   function body here
> >$$
> >LANGUAGE plfoo;
> >
> >Similarly, a CREATE TEMPORARY FUNCTION could be quite handy.
> >
> >Cheers,
> >D
> > 
> >
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

-- 
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778

Remember to vote!


pgsql-hackers by date:

Previous
From: "Jonah H. Harris"
Date:
Subject: Re: Inline PL/pgSQL
Next
From: Neil Conway
Date:
Subject: Re: Inline PL/pgSQL