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

Поиск
Список
Период
Сортировка
От Feike Steenbergen
Тема Add regression tests for autocommit-off mode for psql and fix some omissions
Дата
Msg-id CAK_s-G1T4HRgUATTuP7dANrAxMndDchSNX+NuRCZZUS9WjLqbw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Add regression tests for autocommit-off mode for psql and fix some omissions
Re: Add regression tests for autocommit-off mode for psql and fix some omissions
Список 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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pg_receivexlog and replication slots
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pg_receivexlog and replication slots