Re: Read-only transactions

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Read-only transactions
Date: 2003-01-08 17:03:45
Message-ID: Pine.LNX.4.44.0301081802000.29178-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)gmx(dot)net

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-01-08 17:15:55 Re: Is the 7.3.1 geometry regression test supposed to pass perfectly on Solaris 8 x86?
Previous Message Bruce Momjian 2003-01-08 15:16:55 Re: python interface