Re: Add %z support to elog/ereport?

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add %z support to elog/ereport?
Date: 2014-01-21 15:16:45
Message-ID: 20140121151645.GA17773@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-01-21 12:11:23 -0300, Alvaro Herrera wrote:
> How difficult would it be to have expand_fmt_string deal with positional
> modifiers? I don't think we need anything from it other than the %n$
> notation, so perhaps it's not so problematic.

I don't think there's much reason to go there. I didn't go for the
pg-supplied sprintf() because I thought it'd be considered to
invasive. Since that's apparently not the case...

> > Perhaps we should jettison entirely the idea of using the operating
> > system's built-in sprintf and use one of our own that has all of the
> > nice widgets we need, like a format code that's guaranteed to be right
> > for uint64 and one that's guaranteed to be right for Size. This could
> > turn out to be a bad idea if the best sprintf we can write is much
> > slower than the native sprintf on any common platforms ... and maybe
> > it wouldn't play nice with GCC's desire to check format strings. But
> > what we're doing now is a real nuisance, too.
>
> Maybe we can use our own implementation if the system's doesn't support
> %z. It's present in glibc 2.1 at least, and it's part of in the 2004
> edition of POSIX:2001.
> http://pubs.opengroup.org/onlinepubs/009695399/functions/sprintf.html

Yea, I have a patch for that, will send it as soon as some other stuff
is finished.

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 Robert Haas 2014-01-21 15:20:35 Re: better atomics - v0.2
Previous Message Alvaro Herrera 2014-01-21 15:11:23 Re: Add %z support to elog/ereport?