Re: Any way to execute ad-hoc pl/pgsql? - Mailing list pgsql-general

From Craig Ringer
Subject Re: Any way to execute ad-hoc pl/pgsql?
Date
Msg-id 49FAD96E.5070702@postnewspapers.com.au
Whole thread Raw
In response to Any way to execute ad-hoc pl/pgsql?  ("Carlo Stonebanks" <stonec.register@sympatico.ca>)
List pgsql-general
Carlo Stonebanks wrote:

> (I suppose one possibility would be something that created a temporary
> stored proc to execute the code, then cleaned up after itself.)

Yep, that's what I do -

CREATE FUNCTION fred() RETURNS blah AS $$
$$ LANGUAGE 'plpgsql';

SELECT fred();

DROP FUNCTION fred();

I've only needed it a couple of times in really complex data conversion
and import routines, though.

It'd be really quite nice to have CREATE TEMPORARY FUNCTION even if Pg
didn't have true anonymous blocks (which IMO encourage unnecessary
procedural style coding).

--
Craig Ringer

pgsql-general by date:

Previous
From: Jasen Betts
Date:
Subject: Re: Any way to execute ad-hoc pl/pgsql?
Next
From: Jasen Betts
Date:
Subject: Re: Export Data from one DB and Import into a new DB