Re: temp tables in functions?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Shoaib Mir <shoaibmir(at)gmail(dot)com>
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, jws <jsacksteder(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: temp tables in functions?
Date: 2007-02-08 10:18:43
Message-ID: 20070208101842.GA74109@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 08, 2007 at 12:29:37PM +0500, Shoaib Mir wrote:
> Something like this will help you:
>
> execute immediate 'create temporary table test (a number) on commit drop';

PL/pgSQL doesn't recognize "immediate" and number isn't a PostgreSQL
type so the above yields a syntax error. Also, EXECUTE isn't
necessary for the CREATE TABLE statement, although as Bruno mentioned
EXECUTE will be necessary for other statements due to plan caching.
And ON COMMIT DROP won't help if you call the function multiple
times in the same transaction.

--
Michael Fuhr

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shoaib Mir 2007-02-08 10:38:31 Re: temp tables in functions?
Previous Message Ged 2007-02-08 10:17:46 Array OUT columns in a record returned from a function - part deux