Re: BUG #3718: Unexpected undefined_table error after creating/dropping tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dean" <ratq92nomr(at)hotmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3718: Unexpected undefined_table error after creating/dropping tables
Date: 2007-11-04 16:21:54
Message-ID: 14245.1194193314@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Dean" <ratq92nomr(at)hotmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message ratq nomr 2007-11-04 19:16:39 Re: BUG #3718: Unexpected undefined_table error after creating/dropping tables
Previous Message Michael Meskes 2007-11-04 12:36:38 Re: BUG #3706: ecpg regression: "MOVE FORWARD"