Re: Add %z support to elog/ereport?

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add %z support to elog/ereport?
Date: 2013-11-11 17:40:55
Message-ID: 20131111174055.GI2401@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-11-11 12:31:55 -0500, Robert Haas wrote:
> On Mon, Nov 11, 2013 at 10:50 AM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> > Hi,
> >
> > I'd like to add support for the length modifier %z. Linux' manpages
> > describes it as:
> > z A following integer conversion corresponds to a size_t or ssize_t argument.
> >
> > Since gcc's printf format checks understand it, we can add support for
> > it similar to the way we added %m support.
>
> I seem to recall that our %m support involves rewriting the error
> string twice, which I think is actually kind of expensive if, for
> example, you've got a loop around a PL/pgsql EXCEPTION block.

Yes, it does that. Is that actually where a significant amount of time
is spent? I have a somewhat hard time believing that.

> I'd
> actually like to find a way to get rid of the existing %m support,
> maybe by having a flag that says "oh, and by the way append the system
> error to my format string"; or by changing %m to %s and having the
> caller pass system_error_string() or similar for that format position.

I'd rather get our own printf implementation from somewhere before doing
that which would quite likely result in a bigger speedup besides the
significant portability improvments.

Greetings,

Andres Freund

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2013-11-11 17:57:37 MVCC snapshot timing
Previous Message Andres Freund 2013-11-11 17:37:53 Re: Add %z support to elog/ereport?