Skip site navigation (1) Skip section navigation (2)

ALTER FUNCTION problem

From: Mark Hollomon <mhh(at)mindspring(dot)com>
To: hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: ALTER FUNCTION problem
Date: 2000-12-02 02:38:01
Message-ID: 00120121380100.09339@jupiter.hollomon.fam (view raw or flat)
Thread:
Lists: pgsql-hackers
I am working on an implementation of 'ALTER FUNCTION' and have run into a 
problem.

plpgsql. plperl and pltcl all cache the result of a compile of prosrc.
Which leads to things like:

mhh=# create function f() returns integer as 'begin return 42; end;' language 
'plpgsql';
CREATE
mhh=# select f();
 f  
----
 42
(1 row)

mhh=# alter function f() as 'begin return 44; end;';
ALTER
mhh=# select f();
 f  
----
 42
(1 row)

mhh=# select proname, prosrc from pg_proc where proname = 'f';
 proname |        prosrc         
---------+-----------------------
 f       | begin return 44; end;

Of course, leaving psql and re-entering fixes the problem. But the same 
problem is manifested between concurrent sessions as well.

I would like to propose that a new attribute be added to pg_proc 'proserial'. 
'CREATE FUNCTION' will set proserial to 0. 'ALTER FUNCTION' will increment it
each time. It would be up to the individual PL handlers to check to make sure 
that their cache is not out of date.

Is there a better way to solve this problem?


-- 
Mark Hollomon

Responses

pgsql-hackers by date

Next:From: Mark HollomonDate: 2000-12-02 02:47:51
Subject: Re: Re: [SQL] Rules with Conditions: Bug, or Misunderstanding
Previous:From: Michael ForkDate: 2000-12-02 00:24:05
Subject: ODBC Driver

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group