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

Re: snprintf causes regression tests to fail

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Nicolai Tufar <ntufar(at)gmail(dot)com>
Cc: Magnus Hagander <mha(at)sollentuna(dot)net>,pgsql-hackers(at)postgresql(dot)org, pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: snprintf causes regression tests to fail
Date: 2005-03-01 04:54:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-hackers-win32
Nicolai Tufar wrote:
> Regression test diff is attached.
> It fails on the following tests:
>    int8
>    subselect
>    union
>    sequence
> It fails to display correctly number "4567890123456789".
> In output is shows "-869367531". Apparent overflow or
> interpreting int8 as int4.
> while rewriting snprintf() I did not touch the actual functions
> that convert number to ASCII digit string. In truth, if you
> force PostgreSQL to use snprintf.c without my patch applied
> it produces the same errors.
> What can be wrong? GCC bug? The one I use is:
> gcc.exe (GCC) 3.3.1 (mingw special 20030804-1)

I can confirm your failure in current sources on Win32:

	template1=# create table test(x int8);
	template1=# insert into test values ('4567890123456789');
	INSERT 17235 1
	template1=# select * from test;
	(1 row)

and it knows it is a large number:

	template1=# select * from test where x > 1000::int8;
	(1 row)
	template1=# select * from test where x < 1000::int8;
	(0 rows)

I am going to add some debugs to see what is being passed to *printf().

  Bruce Momjian                        |
  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


pgsql-hackers by date

Next:From: Robert TreatDate: 2005-03-01 05:32:43
Subject: mysterious log output
Previous:From: Greg Sabino MullaneDate: 2005-03-01 02:47:02
Subject: Re: Development Plans

pgsql-hackers-win32 by date

Next:From: Bruce MomjianDate: 2005-03-01 05:55:20
Subject: Re: snprintf causes regression tests to fail
Previous:From: Bruce MomjianDate: 2005-03-01 00:38:39
Subject: Re: Thread-safe snprintf() vsnprintf() and printf()

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