Re: temporary functions (and other object types)

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: temporary functions (and other object types)
Date: 2010-11-05 19:46:42
Message-ID: 76FCC886-3175-479D-9824-6F3EB53B4450@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Nov 5, 2010, at 12:36 PM, Alvaro Herrera wrote:

> Hi,
>
> A customer of ours has the need for temporary functions. The use case
> is writing test cases for their databases: the idea being that their
> code creates a temp function which then goes away automatically at
> session end, just like a temp table. It's said that this makes things
> generally easier for the test harness.

This is one reason why I recommend that pgTAP tests run inside a transaction.

> Other object types that would also be useful to have as temp-able are
> types, domains and casts; and perhaps (if someone sees a need)
> aggregates and operators. Other objects are not necessary, but if
> someone thinks that some more stuff should be made temp-able, we'd try
> to go for as general a solution as possible. But these aren't critical;
> functions are the main pain point.

Running the tests inside a transaction gives you this for free, right now -- *and* leaves the database in a known state at the end (modulo sequences).

Can you just use transactions?

Best,

David

PS: What test framework and harness are you using?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marti Raudsepp 2010-11-05 19:52:45 Re: [PATCH] Revert default wal_sync_method to fdatasync on Linux 2.6.33+
Previous Message Szymon Guz 2010-11-05 19:38:53 Re: temporary functions (and other object types)