Re: BUG #13841: Unable to set autocommit in psql

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: rob stone <floriparob(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13841: Unable to set autocommit in psql
Date: 2016-01-02 18:01:25
Message-ID: CAECtzeV7hjr60iS0mZhtC2debn3eVEVh2k+g7E=cO-Z2Md=Q2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

2016-01-02 18:56 GMT+01:00 rob stone <floriparob(at)gmail(dot)com>:

> On Fri, 2016-01-01 at 12:04 -0500, Tom Lane wrote:
> > "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > > > 2016-01-01 16:10 GMT+01:00 <floriparob(at)gmail(dot)com>:
> > > > > Thought that I'd made a typo but entered as per doco.
> >
> > > Though when referencing the documentation in a report like this it
> > > is
> > > generally helpful to provide a link to said documentation so it at
> > > least
> > > can be checked.
> >
> > Indeed. "set autocommit to off" hasn't been supported since PG 7.3,
> > more
> > than ten years ago. So if there's still some documentation somewhere
> > recommending that, we really need to find and fix it.
> >
> > regards, tom lane
>
>
> Thanks for all the replies.
>
> If you search for "autocommit" in the 9.5rc1 doco the first entry
> displayed takes you to:-
>
> http://www.postgresql.org/docs/9.5/static/ecpg-sql-set-autocommit.html
>
> and as "set" is bog standard SQL syntax I thought you could use it
> within a psql session.
>
>
Well, the page clearly says that "SET AUTOCOMMIT is an extension of
PostgreSQL ECPG.".

> However, as David pointed out you need to use \set.
> Using \set works fine.
>
>
Good to hear.

> After perusing the psql doco there is mention there of using a .psqlrc
> file to hold psql session variables but I have yet to find any doco
> describing the syntax of this file.
> Nor can I find a file named psqlrc, as both are mentioned in the psql
> doco.
>
>
The .psqlrc file can contain any meta commands (\something) or SQL commands.

> So, maybe initdb needs to create a dummy psqlrc file which users can
> alter for global useage or copy over to their $HOME directory and alter
> it for personal use.
>
>
I don't think so. And there's already one in the "share" directory (search
for a psqlrc.sample file).

--
Guillaume.
http://blog.guillaume.lelarge.info
http://www.dalibo.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2016-01-03 00:10:47 Re: BUG #13840: pg_dump generates unloadable SQL when third party string type index option is used
Previous Message rob stone 2016-01-02 17:56:51 Re: BUG #13841: Unable to set autocommit in psql