pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: chained transactions
Date: Mon, 18 Mar 2019 11:22:40 +0100
Message-ID: <db51c67a-3747-8a01-4a74-49b22aefb32d@2ndquadrant.com> (raw)
In-Reply-To: <20190216052222.djehwrd3dtdauk6u@alap3.anarazel.de>
References: <28536681-324b-10dc-ade8-ab46f7645a5a@2ndquadrant.com>
	<b989871c-b2d9-42b9-4461-ace590d1a7c0@iki.fi>
	<20181002053854.GA11712@paquier.xyz>
	<ae851ab9-1e53-2200-cbdd-5823160a0367@2ndquadrant.com>
	<alpine.DEB.2.21.1811041203540.7070@lancre>
	<adb990de-c96d-c685-ddc1-5489aaf49316@2ndquadrant.com>
	<alpine.DEB.2.21.1812260824270.32444@lancre>
	<a08a4da5-1e13-c4d1-6e80-86155f946928@2ndquadrant.com>
	<20190216052222.djehwrd3dtdauk6u@alap3.anarazel.de>

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




view thread (28+ messages)  latest in thread

Message-ID: <db51c67a-3747-8a01-4a74-49b22aefb32d@2ndquadrant.com>
Permalink:  ../db51c67a-3747-8a01-4a74-49b22aefb32d@2ndquadrant.com/
Also on:    postgresql.org/message-id/db51c67a-3747-8a01-4a74-49b22aefb32d@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, andres@anarazel.de, coelho@cri.ensmp.fr
  Subject: Re: chained transactions
  In-Reply-To: <db51c67a-3747-8a01-4a74-49b22aefb32d@2ndquadrant.com>
  References: <28536681-324b-10dc-ade8-ab46f7645a5a@2ndquadrant.com> <b989871c-b2d9-42b9-4461-ace590d1a7c0@iki.fi> <20181002053854.GA11712@paquier.xyz> <ae851ab9-1e53-2200-cbdd-5823160a0367@2ndquadrant.com> <alpine.DEB.2.21.1811041203540.7070@lancre> <adb990de-c96d-c685-ddc1-5489aaf49316@2ndquadrant.com> <alpine.DEB.2.21.1812260824270.32444@lancre> <a08a4da5-1e13-c4d1-6e80-86155f946928@2ndquadrant.com> <20190216052222.djehwrd3dtdauk6u@alap3.anarazel.de> <db51c67a-3747-8a01-4a74-49b22aefb32d@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox