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 <[EMAIL PROTECTED]> wrote:

"dfx" <[EMAIL PROTECTED]> 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

Reply via email to