Re: Reliably finding temporary table

From: Dan Black <fireworker(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Reliably finding temporary table
Date: 2005-06-10 07:03:41
Message-ID: 27f6062505061000032c67d522@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Help! I have a similar problem. Does anybody know how to solve a problem

2005/6/8, Ian Burrell <ianburrell(at)gmail(dot)com>:
>
> We have some functions which need to dynamically create a temporary
> table if it does not already exist. We use the following function:
>
> CREATE OR REPLACE FUNCTION test_date_time_exists() RETURNS BOOLEAN AS '
> BEGIN
> RETURN EXISTS (
> SELECT * FROM pg_class
> WHERE relname = ''test_date_time''
> AND pg_table_is_visible(oid)
> );
> END;
> ' LANGUAGE 'plpgsql' STABLE
>
> However, this has been failing occassionally with errors like
>
> ERROR: cache lookup failed for relation 3454264547
>
> From looking in the list archives, I found a description of
> pg_table_is_visible failing because it has different snapshot
> semantics than the SELECT. Is there a solution for this problem? Is
> there another function I can use? What is a better way to detect temp
> tables visible to the session?
>
> - Ian
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Verba volent, scripta manent
My ISP - http://www.netbynet.ru

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dinesh Pandey 2005-06-10 07:10:39 Permission denied for language pltclu
Previous Message Russ Brown 2005-06-10 06:23:31 Re: Version Control?