Search Postgresql Archives

Re: prepared statement already exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 13, 2006 at 10:48:37AM -0700, Jim Bryan wrote:
> Hi!  In a function to insert rows into a table, I keep
> getting ERROR: prepared statement "updateplan" already
> exists.  If any ideas; thanks.

As the error says, you already have a prepared statement named
"updateplan".  To reuse that name you'll need to DEALLOCATE it
first.  However, then you'll get the following error:

test=> SELECT testPreparedStatement();
ERROR:  function updateplan(integer, integer) does not exist

That's because the PL/pgSQL command EXECUTE is different than the
SQL command EXECUTE:

http://www.postgresql.org/docs/8.1/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

You don't need to use prepared statements in PL/pgSQL functions
because the language automatically prepares and caches query plans.
Just do the INSERT directly.

-- 
Michael Fuhr


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux