Re: ERRCODE_READ_ONLY_SQL_TRANSACTION - Mailing list pgsql-hackers

From Tom Lane
Subject Re: ERRCODE_READ_ONLY_SQL_TRANSACTION
Date
Msg-id 17324.1326407588@sss.pgh.pa.us
Whole thread Raw
In response to ERRCODE_READ_ONLY_SQL_TRANSACTION  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: ERRCODE_READ_ONLY_SQL_TRANSACTION  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
List pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> Hot Standby returns ERRCODE_READ_ONLY_SQL_TRANSACTION in most cases
> for illegal actions on a standby.

> There are two possible but not normally seen cases that give errors,
> but don't set the correct sqlstate, which makes it difficult to
> diagnose misdirected SQL from more normal SQL problems.

> *Patch corrects this. Thanks to Dimitri for the report.

I don't think I like this patch: you are promoting what are and ought to
be very low-level internal sanity checks into user-facing errors (which
among other things will require translation effort for the messages).
I note that you didn't bother even to adjust the adjacent comments
saying this should never happen.

What I want to know is what code path led to these and why the read-only
ereport did not occur at a far higher level.  If we have gaps in the RO
checking we should be fixing them somewhere else, not band-aiding here.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Remembering bug #6123
Next
From: Tom Lane
Date:
Subject: Re: Remembering bug #6123