Tom Lane writes:
> case T_VacuumStmt:
> /* No XactReadOnly check since this logically changes no data */
> vacuum((VacuumStmt *) parsetree);
> break;
>
> Then it'll be hard to miss the need to think about this when adding a
> new statement.
Well, I had one big check at the top so it doesn't have to be spread out
so much:
static void
check_xact_readonly(Node *parsetree)
{if (!XactReadOnly) return;
switch (nodeTag(parsetree)){ case T_AlterDatabaseSetStmt: case T_AlterDomainStmt: case T_AlterGroupStmt:
[...] case T_DropUserStmt: case T_GrantStmt: case T_TruncateStmt: elog(ERROR, "transaction is
read-only"); break;}
}
--
Peter Eisentraut peter_e@gmx.net