Error code returned by lock_timeout

Started by Boszormenyi Zoltanover 12 years ago3 messages
#1Boszormenyi Zoltan
zb@cybertec.at

Hi,

I just realized that in the original incarnation of lock_timeout,
I used ERRCODE_LOCK_NOT_AVAILABLE (to be consistent with NOWAIT)
but the patch that was accepted into 9.3 contained ERRCODE_QUERY_CANCELED
which is the same as for statement_timeout.

Which would be more correct?

Thanks in advance,
Zolt�n B�sz�rm�nyi

--
----------------------------------
Zolt�n B�sz�rm�nyi
Cybertec Sch�nig & Sch�nig GmbH
Gr�hrm�hlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/

#2Fujii Masao
masao.fujii@gmail.com
In reply to: Boszormenyi Zoltan (#1)
Re: Error code returned by lock_timeout

On Thu, Jun 27, 2013 at 2:22 PM, Boszormenyi Zoltan <zb@cybertec.at> wrote:

Hi,

I just realized that in the original incarnation of lock_timeout,
I used ERRCODE_LOCK_NOT_AVAILABLE (to be consistent with NOWAIT)
but the patch that was accepted into 9.3 contained ERRCODE_QUERY_CANCELED
which is the same as for statement_timeout.

Which would be more correct?

ISTM that ERRCODE_LOCK_NOT_AVAILABLE is more suitable...

Regards,

--
Fujii Masao

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Boszormenyi Zoltan
zb@cybertec.at
In reply to: Fujii Masao (#2)
1 attachment(s)
Re: Error code returned by lock_timeout

2013-06-27 17:03 keltez�ssel, Fujii Masao �rta:

On Thu, Jun 27, 2013 at 2:22 PM, Boszormenyi Zoltan <zb@cybertec.at> wrote:

Hi,

I just realized that in the original incarnation of lock_timeout,
I used ERRCODE_LOCK_NOT_AVAILABLE (to be consistent with NOWAIT)
but the patch that was accepted into 9.3 contained ERRCODE_QUERY_CANCELED
which is the same as for statement_timeout.

Which would be more correct?

ISTM that ERRCODE_LOCK_NOT_AVAILABLE is more suitable...

I think, too. Can someone commit this one-liner to master and 9.3?

Best regards,
Zolt�n Bs�sz�rm�nyi

--
----------------------------------
Zolt�n B�sz�rm�nyi
Cybertec Sch�nig & Sch�nig GmbH
Gr�hrm�hlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/

Attachments:

lock_timeout-errcode-fix.patchtext/x-patch; name=lock_timeout-errcode-fix.patchDownload
--- src/backend/tcop/postgres.c~	2013-06-27 07:05:08.000000000 +0200
+++ src/backend/tcop/postgres.c	2013-06-27 17:10:28.040972642 +0200
@@ -2900,7 +2900,7 @@
 			DisableNotifyInterrupt();
 			DisableCatchupInterrupt();
 			ereport(ERROR,
-					(errcode(ERRCODE_QUERY_CANCELED),
+					(errcode(ERRCODE_LOCK_NOT_AVAILABLE),
 					 errmsg("canceling statement due to lock timeout")));
 		}
 		if (get_timeout_indicator(STATEMENT_TIMEOUT, true))