Re: [HACKERS] problems with dropped columns

From: Kevin Brown <kevin(at)sysexperts(dot)com>
To: pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] problems with dropped columns
Date: 2003-03-06 21:52:47
Message-ID: 20030306215247.GU1833@filer
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)com> writes:
> > Taking it a bit further...
>
> There are (at least) two distinct problems involved here. One is
> getting plpgsql to deal correctly with rowtypes that include dropped
> columns. The other is getting it to react when someone alters a table
> whose rowtype is relied on by already-compiled functions.
>
> The former problem is just a small matter of programming in plpgsql;
> I'm not sure what the best way to do it is, but it's clearly just
> plpgsql's issue. The latter problem calls for a ton of infrastructure
> that we haven't got :-(

Hmm, well...

- Keeping timestamps of when the table definition was last changed and
when the function was last compiled, and then having the language
interpreter check the two before executing the function (and
recompile it when the function is out of date) would solve the
problem (and require relatively little additional infrastructure),
but I would expect the performance hit to be too high to be worth
it.

- Alternatively, the language compiler could record a dependency
between the function and the table (assuming this isn't done
already), and be told to recompile the function when the table
definition changes. This gets real messy when you're talking about
doing this in a transaction, unless the compilation itself is
something that can be rolled back (it wouldn't surprise me in the
least if the compiled definition is stored in a table already and
thus can be rolled back).

- Alternatively, recompilation could be made a manual thing,
e.g. ALTER FUNCTION blah RECOMPILE. It would still be a win for
this to be transaction-capable.

--
Kevin Brown kevin(at)sysexperts(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Siva Kumar 2003-03-06 21:59:55 Re: foreign key constraint across databases
Previous Message Ed L. 2003-03-06 21:45:41 Re: replicating DDL statements

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2003-03-06 23:08:17 Re: XML ouput for psql
Previous Message Michael Loftis 2003-03-06 21:50:46 Re: Best setup for RAM drive