From: jwieck@debis.com
To: pawel@astercity.net
Cc: pgsql-sql@postgreSQL.org
Cc: pgsql-hackers@postgreSQL.org
Subject: PL/pgSQL / SPI and UTILITY statements
Date: Mon, 1 Feb 1999 15:20:50 +0100 (MET)
Message-ID: <m107KDa-000EBPC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <m0zxq3u-000EBRC@orion.SAPserv.Hamburg.dsh.de>
Hi,
there was recently discussion about schema changes (utility
queries) inside of PL functions etc.
I've thought about it some more and came to the conclusion
that it doesn't make much sense to support something like
that in PL/pgSQL.
The reason for this is that PL/pgSQL does prepare and save
ALL plans on the first call of the function. As it is now, a
PL/pgSQL function used once in a connection will get broken
if an object it uses gets dropped and recreated. The saved
SPI plans still use the OLD object, which isn't available any
more. So the function needs to be recompiled and that will
only happen on a new backend connection.
There is no syntax that could tell PL/pgSQL not to save a
particular prepared plan (like in PL/Tcl where planning and
saving is done separately, so the programmer has control
which plans to save and which not).
Since dropping an object in Postgres is a general problem
that affects saved SPI plans (not only in PL, C language
functions using the SPI saved plan feature will break too),
I'll not add support for it to PL/pgSQL. I think this problem
will also show up if any function using prepared plans will
be used on the temp tables Bruce currently is working on.
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jwieck@debis.com, pawel@astercity.net, pgsql-hackers@postgreSQL.org
Subject: Re: PL/pgSQL / SPI and UTILITY statements
In-Reply-To: <m107KDa-000EBPC@orion.SAPserv.Hamburg.dsh.de>
References: <m0zxq3u-000EBRC@orion.SAPserv.Hamburg.dsh.de> <m107KDa-000EBPC@orion.SAPserv.Hamburg.dsh.de>
* 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