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;