Re: Patch: Show process IDs of processes holding a lock; show relation and tuple infos of a lock to acquire

From: Christian Kruse <christian(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: Show process IDs of processes holding a lock; show relation and tuple infos of a lock to acquire
Date: 2014-01-22 19:34:45
Message-ID: 20140122193445.GE3726@defunct.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

attached you will find a new version of the patch containing more
comments.

On 22/01/14 12:00, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> > This ngettext() call is repeated four times in the new code, which is a
> > bit annoying because it's not trivial. I think you could assign the
> > ngettext() to a char * at the bottom of the loop, and then in the
> > ereport() calls use it:
>
> Would that not break the compiler's ability to verify the format codes
> in the string? Not to mention make it harder for people to compare
> format to arguments, too?

I agree.

> However, the real problem here is that you shouldn't be calling ngettext
> manually in an ereport context in the first place. There is
> infrastructure in place for that, and this isn't using it.

Fixed in attached patch. I changed it from calling
errorcontext(ngettext()) to calling errdetail_plural().

Best regards,

--
Christian Kruse http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
show_pids_in_lock_log_v3.patch text/x-diff 4.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2014-01-22 19:35:36 Re: plpgsql.consistent_into
Previous Message Kevin Grittner 2014-01-22 19:18:28 Re: proposal: hide application_name from other users