- Mailing list pgsql-hackers

From James Robinson
Subject
Date
Msg-id 0E52590C-3DD9-418A-97D2-054CF8DCCC69@socialserve.com
Whole thread Raw
List 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



pgsql-hackers by date:

Previous
From: Patrick Welche
Date:
Subject: Re: inet increment with int
Next
From: Michael Fuhr
Date:
Subject: Re: PL/PGSQL and drop/create table