Re: Add %z support to elog/ereport?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add %z support to elog/ereport?
Date: 2014-01-18 00:42:35
Message-ID: 29415.1390005755@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> On 2014-01-17 13:50:08 -0500, Tom Lane wrote:
>> I think a better solution approach is to teach our src/port/snprintf.c
>> about the z flag, then extend configure's checking to force use of our
>> snprintf if the platform's version doesn't handle z.

> Hm. I had thought about that, but dismissed it because I thought people
> would argue about it being too invasive...

How so? It'd be a lot less invasive than what we'd have to do to use
'z' flags the other way.

> If we're going there, we should just eliminate expand_fmt_string() from
> elog.c and test for it in configure too, right?

If you mean "let's rely on glibc for %m", the answer is "not bloody
likely". See useful_strerror(), which is functionality we'd lose if
we short-circuit that.

>> You suggest below that we could invent some additional
>> macros to support that; but since the "z" flag is in C99, there really
>> ought to be only a small minority of platforms where it doesn't work.

> Well, maybe just a minority numberwise, but one of them being windows
> surely makes it count in number of installations...

Agreed, but I believe we're already using src/port/snprintf.c on Windows
because of lack of %n$ support (which is also required by C99).

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Florian Pflug 2014-01-18 01:20:26 Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Previous Message Andres Freund 2014-01-18 00:35:21 Re: [Lsf-pc] Linux kernel impact on PostgreSQL performance (summary v2 2014-1-17)