From: Richard Huxton <dev@archonet.com>
To: Penchalaiah P. <penchalaiahp@infics.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: hi may i know y am i getting this error
Date: Fri, 17 Nov 2006 11:04:53 +0000
Message-ID: <455D9755.7090206@archonet.com> (raw)
In-Reply-To: <A70AE049E81A6A40879D5DC0AC8C38C9078D7304@venus.infics.com>
References: <A70AE049E81A6A40879D5DC0AC8C38C9078D7304@venus.infics.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, penchalaiahp@infics.com
Subject: Re: hi may i know y am i getting this error
In-Reply-To: <455D9755.7090206@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox