Re: BUG #3718: Unexpected undefined_table error after creating/dropping tables - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #3718: Unexpected undefined_table error after creating/dropping tables
Date
Msg-id 14245.1194193314@sss.pgh.pa.us
Whole thread Raw
In response to BUG #3718: Unexpected undefined_table error after creating/dropping tables  ("Dean" <ratq92nomr@hotmail.com>)
Responses Re: BUG #3718: Unexpected undefined_table error after creating/dropping tables
List pgsql-bugs
"Dean" <ratq92nomr@hotmail.com> writes:
> If I create a function which relies on the undefined_table exception to test
> if a table exists, it does not behave as expected.

Try issuing the DELETE via EXECUTE --- you're getting burnt by plan
caching.

But actually, do you really want something as destructive as DELETE
for an existence probe?  I'd try

    PERFORM 'bar'::text::regclass;

and see if that throws an error.  (The double cast is important here,
so that you get a runtime lookup not a compile-time one.)

            regards, tom lane

pgsql-bugs by date:

Previous
From: Michael Meskes
Date:
Subject: Re: BUG #3706: ecpg regression: "MOVE FORWARD"
Next
From: ratq nomr
Date:
Subject: Re: BUG #3718: Unexpected undefined_table error after creating/dropping tables