Re: ERRCODE_READ_ONLY_SQL_TRANSACTION

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ERRCODE_READ_ONLY_SQL_TRANSACTION
Date: 2012-01-12 22:33:08
Message-ID: 17324.1326407588@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs <simon(at)2ndQuadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-01-12 22:44:16 Re: Remembering bug #6123
Previous Message Kevin Grittner 2012-01-12 22:31:51 Re: Remembering bug #6123