Changed error message for blocks by prepared transactions

Lists: pgsql-hackers
From: Andreas 'ads' Scherbaum <adsmail(at)wars-nicht(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Changed error message for blocks by prepared transactions
Date: 2009-06-22 21:53:19
Message-ID: 20090622235319.71efc348@iridium.wars-nicht.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Hello,

the small attached patch changes the error message for a blocked
database in case there are prepared transactions. The original message
"accessed by other users" is misleading.

Example:

----- snip -----
postgres=# begin;
BEGIN
postgres=# prepare transaction 'abc';
PREPARE TRANSACTION
postgres=# \c template1
psql (8.4rc1)
Sie sind jetzt verbunden mit der Datenbank »template1«.
template1=# alter database postgres rename to test;
ERROR: database "postgres" is being blocked by prepared transactions
DETAIL: There are 1 prepared transaction(s) using the database.
----- snip -----

Translation still pending, how to add new messages to the .po files?

Kind regards

--
Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project

PGDay.eu 2009 in Paris, Nov. 6/7, http://www.pgday.eu/

Attachment Content-Type Size
different_msg_for_prep_transactions.diff text/x-patch 4.0 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Andreas 'ads' Scherbaum" <adsmail(at)wars-nicht(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Changed error message for blocks by prepared transactions
Date: 2009-06-22 23:24:28
Message-ID: 3631.1245713068@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Andreas 'ads' Scherbaum" <adsmail(at)wars-nicht(dot)de> writes:
> the small attached patch changes the error message for a blocked
> database in case there are prepared transactions.

Isn't this duplicative of the errdetail_busy_db code? And anyway
I do not see a reason not to consider prepared transactions as
"other users".

regards, tom lane


From: Andreas 'ads' Scherbaum <adsmail(at)wars-nicht(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Changed error message for blocks by prepared transactions
Date: 2009-06-23 09:16:38
Message-ID: 20090623111638.02f75579@iridium.wars-nicht.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, 22 Jun 2009 19:24:28 -0400 Tom Lane wrote:

> "Andreas 'ads' Scherbaum" <adsmail(at)wars-nicht(dot)de> writes:
> > the small attached patch changes the error message for a blocked
> > database in case there are prepared transactions.
>
> Isn't this duplicative of the errdetail_busy_db code? And anyway
> I do not see a reason not to consider prepared transactions as
> "other users".

Because you know the details.
Most other users check pg_stat_activity just to find out there is no
other user connected. A prepared transaction is not a connected user,
so the error message is still misleading.

You are right with the errdetail_busy_db(), but that's only true for
8.4, not for earlier versions. In addition that's only true if you
haven't supressed the hints like some scripts do (-q as example).

Bye

--
Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project

PGDay.eu 2009 in Paris, Nov. 6/7, http://www.pgday.eu/