Search Postgresql Archives

Re: Check the existance of temporary table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx> wrote:
"dfx" <dfx@xxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux