port/snprintf.c (was Re: Numeric 508 datatype)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: port/snprintf.c (was Re: Numeric 508 datatype)
Date: 2005-12-05 02:50:15
Message-ID: 12273.1133751015@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> OK, snprintf.c fixed. I added a 'stream' and outlen parameter to all
> the calls, and cleaned up the switch() statement that was outputing
> twice. When we were outputing just to a string, it didn't matter, but
> now that we are also outputting to a stream, it does.

I found a whole bunch more problems than this :-(. I've committed a
cleaned-up version that seems to work correctly in a simple standalone
testbed, but it'd be a good idea to exercise it inside PG as well.
Can you try regression tests and the factorial() problem on CVS tip?

The problems are sufficiently bad that it might be a good idea to
backport the fixes into 8.0 and before as well --- but I note that
the ABI is different (pg_snprintf vs snprintf, etc) so this requires
a bit of investigation rather than just committing the file as-is.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2005-12-05 03:18:10 Re: port/snprintf.c (was Re: Numeric 508 datatype)
Previous Message Bruce Momjian 2005-12-05 02:34:13 Re: Some rare questions

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-12-05 03:05:35 Re: MIN() performance regression 8.0 -> 8.1
Previous Message Christopher Kings-Lynne 2005-12-05 01:57:21 Re: SERIAL type feature request

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-12-05 03:18:10 Re: port/snprintf.c (was Re: Numeric 508 datatype)
Previous Message Andrew Dunstan 2005-12-04 23:08:09 Re: [PATCHES] snprintf() argument reordering not working