Re: ERROR: relation with OID XXXX does not exist

From: "David Monarchi" <david(dot)e(dot)monarchi(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: ERROR: relation with OID XXXX does not exist
Date: 2007-08-18 15:08:24
Message-ID: eea51fdb0708180808g46004899ve91d76a19f2c866a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thanks, Tom. I'll look forward to 8.3.

If I understand correctly, TRUNCATE is equivalent to DELETE FROM. My
problem was that I also needed to reset the serial attribute. My solution
was the following

-- clear and reset counter
delete from dom1_classid_sorted_temp;
perform
setval('dom1_classid_sorted_temp_class_rank_dom_seq'::regclass,1,false);

Thanks again.

Best,
david

On 8/17/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> "David Monarchi" <david(dot)e(dot)monarchi(at)gmail(dot)com> writes:
> > I am executing a function which includes the code fragment shown
> below. It
> > goes through the loop and then fails with the error message
> > ERROR: relation with OID 591161 does not exist
>
> I think the problem is here:
>
> > -- drop & recreate table for sorting
> > drop table if exists dom1_classid_sorted_temp;
> > create table dom1_classid_sorted_temp (id_dom integer, class_rank_dom
> > serial) without oids;
>
> plpgsql tries to cache plans for its queries, and dropping a table
> invalidates any already-made plans for that table. Can you TRUNCATE
> the table instead?
>
> PG 8.3 will be smarter about this sort of thing.
>
> regards, tom lane
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Rajaram J 2007-08-19 08:18:17 FATAL: no pg_hba.conf entry for host "???", user "rajaram", database "template1", SSL off
Previous Message Tom Lane 2007-08-18 05:10:41 Re: ERROR: relation with OID XXXX does not exist