Re: hi may i know y am i getting this error

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Penchalaiah P(dot)" <penchalaiahp(at)infics(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: hi may i know y am i getting this error
Date: 2006-11-17 11:04:53
Message-ID: 455D9755.7090206@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Penchalaiah P. wrote:
> Hi
>
> When I am executing my function its giving error.. first time its
> running properly.. but when I am executing second time I am getting
> error

> create table dummy_table without oids as
...
> update dummy_table set irla_code=l_p where irla_code=''P'';
...
> ERROR: relation with OID 75275 does not exist
>
> CONTEXT: SQL statement "update dummy_table set irla_code= $1 where
> irla_code='P'"

The queries in plpgsql have their query-plans compiled the first time
they are executed. This means that the first time you ran the function
you created dummy_table with an OID of 75275. The second time, it was
re-created with a different OID, but the update query doesn't know this.
Its plan tries to access a table with OID=75275 and fails.

Solution: read up on the EXECUTE <string> statement that allows you to
build dynamic queries.

Also, you might want to read up on creating temporary tables.

HTH
--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2006-11-17 11:07:16 Re: hi may i know y am i getting this error
Previous Message Penchalaiah P. 2006-11-17 09:45:25 hi may i know y am i getting this error