Re: [GENERAL] problems with dropped columns - Mailing list pgsql-hackers

From Kevin Brown
Subject Re: [GENERAL] problems with dropped columns
Date
Msg-id 20030306215247.GU1833@filer
Whole thread Raw
In response to Re: [GENERAL] problems with dropped columns  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Joe Conway <mail@joeconway.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@sysexperts.com

pgsql-hackers by date:

Previous
From: Michael Loftis
Date:
Subject: Re: Best setup for RAM drive
Next
From: Peter Eisentraut
Date:
Subject: Re: XML ouput for psql