\set AUTOROLLBACK ON

From: Joel Jacobson <joel(at)trustly(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Lukas Gratte <lukas(at)trustly(dot)com>
Subject: \set AUTOROLLBACK ON
Date: 2017-06-26 14:00:55
Message-ID: CAASwCXc3v9ErsVHcr+O6UwKS3M-7WRi+3yb4qKXE44MO6cXwjw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

A colleague of mine wondered if there is a way to always run
everything you type into psql in a db txn and automatically rollback
it as soon as it finish.
I couldn't think of any way to do so, but thought it would be a nice
feature and probably quite easy to add to psql, so I thought I should
suggest it here.

The typical use-case is you are doing something in production that you
just want to
a) test if some query works like expected and then rollback
or,
b) read-only queries that should not commit any changes anyway, so
here the rollback would just be an extra layer of security, since your
SELECT might call volatile functions that are actually not read-only

Thoughts?

/Joel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2017-06-26 14:05:03 Re: intermittent failures in Cygwin from select_parallel tests
Previous Message Tom Lane 2017-06-26 13:54:04 Re: A mistake in a comment