From: | "Dmitry Koterov" <dmitry(at)koterov(dot)ru> |
---|---|
To: | |
Cc: | dfx(at)dfx(dot)it, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Check the existance of temporary table |
Date: | 2007-03-25 22:44:34 |
Message-ID: | d7df81620703251544x30303683k8f6d9cf627293d7@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In stored procedures I used something like
BEGIN
CREATE TEMPORARY TABLE tmp ...
EXCEPTION
WHEN ... THEN ...
END
See pg error codes for details (I don't remember exactly, but maybe it is a
dumplicate_table or duplicate_object exception).
On 3/25/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> "dfx" <dfx(at)dfx(dot)it> writes:
> > how I can check the existance of temporary table?
> > I.e. wich query I have to use to know if MY_TEMP_TABLE exists?
>
> As of 8.2 you can do
>
> SELECT ... FROM pg_class
> WHERE relname = 'whatever' AND relnamespace = pg_my_temp_schema();
>
> In earlier releases pg_my_temp_schema() isn't built in, so you have
> to do some pushups to determine which schema is your temp schema.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-03-25 23:08:04 | Re: [GENERAL] Fun with Cursors- how to rewind a cursor |
Previous Message | Tom Lane | 2007-03-25 19:04:10 | Re: [GENERAL] Fun with Cursors- how to rewind a cursor |