Re: plpgsql and schema

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Roberto Pellagatti <roberto(dot)pellagatti(at)ropelsoftware(dot)fastwebnet(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpgsql and schema
Date: 2005-06-23 15:33:27
Message-ID: 20050623153327.GA37108@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jun 22, 2005 at 06:50:40PM +0200, Roberto Pellagatti wrote:
>
> The problem is that i get always the number of rows from the table in
> the schema that was current when I created the function.

PL/pgSQL caches its query plans, so subsequent calls to the function
use the plan created on the first call. You can avoid this plan
caching by using EXECUTE.

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

Note what the documentation says about not being able to get the
result of an EXECUTE query directly. A couple of workarounds are
mentioned.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2005-06-23 15:47:37 Re: plpgsql constraint checked data fails to restore
Previous Message Richard Huxton 2005-06-23 15:28:49 Re: Help me urgently