Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] snprintf causes regression tests to fail

From: Joerg Hessdoerfer <Joerg(dot)Hessdoerfer(at)sea-gmbh(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers-win32(at)postgresql(dot)org,Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>,Nicolai Tufar <ntufar(at)gmail(dot)com>,Magnus Hagander <mha(at)sollentuna(dot)net>
Subject: Re: [HACKERS] snprintf causes regression tests to fail
Date: 2005-03-02 08:24:32
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-hackers-win32

On Wednesday 02 March 2005 01:28, you wrote:
> BTW, you should read the official spec for snprintf:
> There are a couple of interesting things that the present code is most
> certainly not doing correctly, notably:
>      In format strings containing the %n$ form of conversion
>      specifications, numbered arguments in the argument list can be
>      referenced from the format string as many times as required.
> Also it seems that runtime precision specs are required to have explicit
> numbers when used in a %n$ string, which is something I didn't know
> until just now.  This example in the spec is instructive:
>  printf("%1$d:%2$.*3$d:%4$.*3$d\n", hour, min, precision, sec);
> It might be a good idea to go look at whichever *BSD we got this code
> from originally, and see if they've upgraded it to do %n$.  'Cause it
> will take a nontrivial amount of work to get from where we are now to
> something that follows the full spec.

don't know if PG borrowed the code from here, but according to the manpage 
FreeBSD 5.3 seems to have a quite complete implementation, see 

Would this help?

Leading SW developer  - S.E.A GmbH
Mail: joerg(dot)hessdoerfer(at)sea-gmbh(dot)com

In response to


pgsql-hackers by date

Next:From: Christopher Kings-LynneDate: 2005-03-02 08:29:23
Subject: Re: logging as inserts
Previous:From: Tom LaneDate: 2005-03-02 06:33:05
Subject: Re: [pgsql-hackers-win32] [HACKERS] snprintf causes regression tests to fail

pgsql-hackers-win32 by date

Next:From: Richard HuxtonDate: 2005-03-02 08:58:06
Subject: Re: Help with tuning this query
Previous:From: Ken EgervariDate: 2005-03-02 06:51:11
Subject: Help with tuning this query

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group