Re: calling function - Mailing list pgsql-jdbc

From Bhushan Bhangale
Subject Re: calling function
Date
Msg-id C9590F897BFAD7119E63000BCD68208301659532@lmnukpriv.lastminute.com
Whole thread Raw
In response to calling function  (Bhushan Bhangale <bbhangale@Lastminute.com>)
Responses Re: calling function  (James Robinson <jlrobins@socialserve.com>)
List 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@socialserve.com]
Sent: 03 March 2004 14:55
To: pgsql-jdbc@postgresql.org
Cc: bbhangale@Lastminute.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
________________________________________________________________________

pgsql-jdbc by date:

Previous
From: James Robinson
Date:
Subject: Re: calling function
Next
From: "Matthias Vach"
Date:
Subject: Same old story :( "Cannot load JDBC driver class 'null'"