On 2019-02-16 06:22, Andres Freund wrote: >> +static int save_XactIsoLevel; >> +static bool save_XactReadOnly; >> +static bool save_XactDeferrable; > > We normally don't define variables in the middle of a file? Also, why > do these need to be global vars rather than defined where we do > chaining? I'm imagining a SavedTransactionState struct declared on the > stack that's then passed to Save/Restore? > > Not crucial, but I do wonder if we can come up with a prettier approach > for this.
If we do it with a struct that is passed to the functions, then either the struct contents will be available outside of xact.c, which will expose internals of xact.c that weren't previously exposed, or we do it with an incomplete struct, but then this would involve palloc across transaction commit, resulting in additional complexity. Neither of these sound like obviously better alternatives. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services