"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