Temp table exists test?? - Mailing list pgsql-novice

From Michael Guerin
Subject Temp table exists test??
Date
Msg-id 4202CCEE.90806@rentec.com
Whole thread Raw
Responses Re: Temp table exists test??
List pgsql-novice
Hi All,

    Is there a way to find out the namespace id (relnamespace) for your
connection?   I grabbed this function from one of the list, however it
doesn't work for temp tables when multiple connections are involved b/c
it will always return true.

Thanks
Michael
-------------------
CREATE OR REPLACE FUNCTION table_exists("varchar")
  RETURNS bool AS
$BODY$

DECLARE
    t_name ALIAS for $1;
    t_result VARCHAR;
BEGIN
    --find table, case-insensitive
    SELECT relname INTO t_result
    FROM pg_class
    WHERE relname ~* ('^' || t_name || '$')
        AND relkind = 'r';
    IF t_result IS NULL THEN
        RETURN FALSE;
    ELSE
        RETURN TRUE;
    END IF;
END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;




pgsql-novice by date:

Previous
From: "Rodolfo J. Paiz"
Date:
Subject: Storing latitude and longitude
Next
From: "Todd Lewis"
Date:
Subject: Re: Calling psql from a bat file on windows?