Re: calling function

From: Bhushan Bhangale <bbhangale(at)Lastminute(dot)com>
To: James Robinson <jlrobins(at)socialserve(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: calling function
Date: 2004-03-03 15:15:21
Message-ID: C9590F897BFAD7119E63000BCD68208301659532@lmnukpriv.lastminute.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Well I would like to use function with plan cached. But how come the table
which I create in the function is part of that. When ever I call the
function it create a table and then drops it. So should not be a problem and
even its not coming.

Initially I tried to write the function without using a temp table but
couldn't.

thanks
Bhushan

-----Original Message-----
From: James Robinson [mailto:jlrobins(at)socialserve(dot)com]
Sent: 03 March 2004 14:55
To: pgsql-jdbc(at)postgresql(dot)org
Cc: bbhangale(at)Lastminute(dot)com
Subject: Re: calling function

Standard queries in plpgsql are parsed / planned only once per backend
session, and the plan stores the object ids of the relations used in
the query, not the names. So, when you drop the table, the cached plan
becomes invalid. If your client disconnects / reconnects, then calls
the function, it will be parsed / planned again, and all is well --
that one time.

If you want to execute queries without having plans cached, you need to
make use of the execute command, the technique specified in section
37.6.4 of the postgres manual:

http://www.postgresql.org/docs/7.4/static/plpgsql-statements.html

But, as Tom said, you can probably rephrase the function to not use a
temp table anymore.

----
James Robinson
Socialserve.com

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Matthias Vach 2004-03-03 15:26:54 Same old story :( "Cannot load JDBC driver class 'null'"
Previous Message James Robinson 2004-03-03 14:55:08 Re: calling function