Re: Surprising behaviour of \set AUTOCOMMIT ON - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: Surprising behaviour of \set AUTOCOMMIT ON
Date
Msg-id 6ff3bee7-183f-4448-9cd3-881c66c63826@mm
Whole thread Raw
In response to Re: Surprising behaviour of \set AUTOCOMMIT ON  (Rushabh Lathia <rushabh.lathia@gmail.com>)
Responses Re: Surprising behaviour of \set AUTOCOMMIT ON
Re: Surprising behaviour of \set AUTOCOMMIT ON
List pgsql-hackers
    Rushabh Lathia wrote:

> It might happen that SetVariable() can be called from other places in
> future,
> so its good to have all the set variable related checks inside
> SetVariable().

There's already another way to skip the \set check: select 'on' as "AUTOCOMMIT" \gset

But there's a function in startup.c which might be the ideal location
for the check, as it looks like the one and only place where the
autocommit flag actually changes:

static void
autocommit_hook(const char *newval)
{    pset.autocommit = ParseVariableBool(newval, "AUTOCOMMIT");
}



Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite



pgsql-hackers by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: Surprising behaviour of \set AUTOCOMMIT ON
Next
From: Simon Riggs
Date:
Subject: Re: autonomous transactions