Re: Surprising behaviour of \set AUTOCOMMIT ON

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Rushabh Lathia" <rushabh(dot)lathia(at)gmail(dot)com>
Cc: "Rahila Syed" <rahilasyed90(at)gmail(dot)com>,"Robert Haas" <robertmhaas(at)gmail(dot)com>,"PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Surprising behaviour of \set AUTOCOMMIT ON
Date: 2016-09-03 11:09:02
Message-ID: 6ff3bee7-183f-4448-9cd3-881c66c63826@mm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2016-09-03 11:09:16 Re: autonomous transactions
Previous Message Daniel Verite 2016-09-03 11:00:09 Re: Surprising behaviour of \set AUTOCOMMIT ON