From: James Robinson <jlrobins(at)socialserve(dot)com>
To: teodor(at)sigaev(dot)ru
Cc: Hackers Development <pgsql-hackers(at)postgresql(dot)org>
Subject:
Date: 2005-09-07 12:59:33
Message-ID: 0E52590C-3DD9-418A-97D2-054CF8DCCC69@socialserve.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> After reconnecting to database all is ok. Is it supposed behaviour?

Yes. The plpgsql interpreter in the backend directs the backend to
prepare and cache every sql statement in the function. The planned
statements reference oids of the tables referenced.

Dropping the connection gets rid of the (now invalid) cached plan.

People have proposed some sort of reparse / replan command, but I
don't know if they could gain consensus.

It'd be really fancy if plpgsql could sniff into the plan structure
of each planned query, looking for table oids, and then registering
itself as being a dependent object of that table, so that upon table
drop the planned function body could be abandoned, and upon next call
to the function, hopefully the table might have been recreated, and
then the function gets planned successfully again. Or, if the table
does not exist yet, then it just fails as normal.

----
James Robinson
Socialserve.com

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Fuhr 2005-09-07 13:36:38 Re: PL/PGSQL and drop/create table
Previous Message Patrick Welche 2005-09-07 12:35:59 Re: inet increment with int