Re: Fix for VACUUM in psql autocommit off - Mailing list pgsql-patches

From Tom Lane
Subject Re: Fix for VACUUM in psql autocommit off
Date
Msg-id 20944.1095623286@sss.pgh.pa.us
Whole thread Raw
In response to Fix for VACUUM in psql autocommit off  ("Michael Paesold" <mpaesold@gmx.at>)
List pgsql-patches
"Michael Paesold" <mpaesold@gmx.at> writes:
> In current cvs (as in version 7.4.5), VACUUM does not work at all in
> autocommit=off mode. That is, because psql does not know that VACUUM cannot
> be performed inside an transaction.
> I consider this a bug and suggest the attached fix.

If we're going to do that, we should also include the other statements
that disallow execution in a transaction, and we should rename
is_transact_command to something more appropriate (not to mention fix
its comments).  A quick grep shows

/home/postgres/pgsql/src/backend/commands/dbcommands.c: 95:     PreventTransactionChain((void *) stmt, "CREATE
DATABASE");
/home/postgres/pgsql/src/backend/commands/dbcommands.c: 497:     PreventTransactionChain((void *) dbname, "DROP
DATABASE");
/home/postgres/pgsql/src/backend/commands/cluster.c: 175:         PreventTransactionChain((void *) stmt, "CLUSTER");
/home/postgres/pgsql/src/backend/commands/indexcmds.c: 995:     PreventTransactionChain((void *) dbname, "REINDEX
DATABASE");
/home/postgres/pgsql/src/backend/commands/vacuum.c: 262:         PreventTransactionChain((void *) vacstmt, stmttype);
/home/postgres/pgsql/src/backend/commands/tablespace.c: 221:     PreventTransactionChain((void *) stmt, "CREATE
TABLESPACE");
/home/postgres/pgsql/src/backend/commands/tablespace.c: 407:     PreventTransactionChain((void *) stmt, "DROP
TABLESPACE");

Handling the multi-keyword cases is going to take a nontrivial increment
of functionality.  Perhaps while we're at it, we could teach this code
about nested /* comments ...

            regards, tom lane

pgsql-patches by date:

Previous
From: "Michael Paesold"
Date:
Subject: Fix for VACUUM in psql autocommit off
Next
From: "Michael Paesold"
Date:
Subject: Re: Fix for VACUUM in psql autocommit off