On 15 November 2017 at 16:36, Peter Eisentraut <peter.eisentr...@2ndquadrant.com> wrote: > On 11/8/17 18:48, Simon Riggs wrote: >> What would happen if some of the INSERTs failed? Where would control >> go to? (Maybe this is just "no change" in this particular proc) > > An exception is raised and unless the exception is caught (depending on > the PL), control leaves the procedure. What is already committed stays. > >> What happens if the procedure is updated during execution? Presumably >> it keeps executing the original version as seen in the initial >> snapshot? > > correct > >> Does the xmin of this session advance after each transaction, or do we >> hold the snapshot used for the procedure body open, causing us to hold >> back xmin and prevent vacuuming from being effective? >> >> What would happen if a procedure recursively called itself? And yet it >> was updated half-way through? Would that throw an error (I think it >> should). > > I don't think anything special happens here. The snapshot that is used > to read the procedure source code and other meta information is released > at a transaction boundary.
I think we need to document that, or at least note in README It's quite important for VACUUM. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services