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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(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: Re: port/snprintf.c (was Re: Numeric 508 datatype)
Date: 2005-12-05 03:18:10
Message-ID: 200512050318.jB53IA810325@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches

Tom Lane wrote:
> 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?

Thanks. Tested 8.1.1 and CVS tip and all compile, and regression pass.
I also tested the factorial test and the result looks perfect, thanks!

> 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.

Not as many 8.0.X platforms used *printf because we didn't test %$ for
its use on that release, so my bet is that very few platforms would be
using it.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-12-05 03:27:00 Re: port/snprintf.c (was Re: Numeric 508 datatype)
Previous Message Tom Lane 2005-12-05 02:50:15 port/snprintf.c (was Re: Numeric 508 datatype)

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-12-05 03:27:00 Re: port/snprintf.c (was Re: Numeric 508 datatype)
Previous Message Tom Lane 2005-12-05 03:17:27 Re: generalizing the planner knobs

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-12-05 03:22:08 Re: TODO item -- Improve psql's handling of multi-line queries
Previous Message Tom Lane 2005-12-05 02:50:15 port/snprintf.c (was Re: Numeric 508 datatype)