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

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Carlo Stonebanks <stonec(dot)register(at)sympatico(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Any way to execute ad-hoc pl/pgsql?
Date: 2009-05-01 11:13:50
Message-ID: 49FAD96E.5070702@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Keaton Adams 2009-05-01 11:20:08 Re: Any way to execute ad-hoc pl/pgsql?
Previous Message Jasen Betts 2009-05-01 11:12:38 Re: Export Data from one DB and Import into a new DB