Temp table exists test??

Поиск
Список
Период
Сортировка
От Michael Guerin
Тема Temp table exists test??
Дата
Msg-id 4202CCEE.90806@rentec.com
обсуждение исходный текст
Ответы Re: Temp table exists test??  (Michael Fuhr <mike@fuhr.org>)
Список 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 по дате отправления:

Предыдущее
От: "Rodolfo J. Paiz"
Дата:
Сообщение: Storing latitude and longitude
Следующее
От: "Todd Lewis"
Дата:
Сообщение: Re: Calling psql from a bat file on windows?