Re: chained transactions - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: chained transactions
Date
Msg-id db51c67a-3747-8a01-4a74-49b22aefb32d@2ndquadrant.com
Whole thread Raw
In response to Re: chained transactions  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: chained transactions
Next
From: Rafia Sabih
Date:
Subject: Re: explain plans with information about (modified) gucs