Add regression tests for autocommit-off mode for psql and fix some omissions

From: Feike Steenbergen <feikesteenbergen(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Add regression tests for autocommit-off mode for psql and fix some omissions
Date: 2014-10-06 10:36:17
Message-ID: CAK_s-G1T4HRgUATTuP7dANrAxMndDchSNX+NuRCZZUS9WjLqbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Lately I have come across two inconveniences/bugs related to running
the autocommit-off mode in psql.

These are:
- BUG #11524: Unable to add value to ENUM when having AUTOCOMMIT
disabled in psql
- BUG #10822: "ALTER SYSTEM cannot run inside a transaction block"
when having autocommit disabled.

The documentation states about autocommit-off in
http://www.postgresql.org/docs/devel/static/app-psql.html :

The autocommit-off mode works by issuing an implicit BEGIN for you,
just before any command that is not already in a transaction block and
is not itself a BEGIN or other transaction-control command, nor a
command that cannot be executed inside a transaction block (such as
VACUUM).

In src/bin/psql/common.c the statements which should not start a
transaction implicitly are filtered in command_no_begin.

I would like to propose to add a regression test for all statements
that call PreventTransactionChain in autocommit-off mode. I propose to
add these tests to src/test/regress/sql/psql.sql as this is a
psql-specific mode.
Alternatively an isolated test called autocommit.sql could be created.

During the writing of the regression test I found another statement
not covered in the current function: DROP INDEX CONCURRENTLY.

After applying this patch, the only command that I can find currently
which cannot be executed inside a transaction block and is currently
not able to be run in autocommit-off is "ALTER TYPE name ADD VALUE";

I have created a patch consisting of a regression test and adding DROP
INDEX CONCURRENTLY to command_no_begin.

Kind regards,

Feike Steenbergen

Attachment Content-Type Size
20141006_autocommit-off_regression.patch application/octet-stream 3.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-10-06 10:38:10 Re: pg_receivexlog and replication slots
Previous Message Andres Freund 2014-10-06 10:14:21 Re: pg_receivexlog and replication slots