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

Re: [PORTS] Port Bug Report: pg_dump -d database >unload.file; cat unload.file|psql database ARE NOT EQUAL

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: karpov(at)allonge(dot)viaduk(dot)net
Cc: hackers(at)postgreSQL(dot)org (PostgreSQL-development), lockhart(at)alumni(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Subject: Re: [PORTS] Port Bug Report: pg_dump -d database >unload.file; cat unload.file|psql database ARE NOT EQUAL
Date: 1998-03-28 20:16:46
Message-ID: 199803282016.PAA17441@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
>   PostgreSQL version : 6.3-980326
> Problem Description:
> --------------------
> Parser generated error message when script was inserting
> a value equal -1 into column of float8 type.
> If exchange -1 to -1.0 - no errors. 
> 
> --------------------------------------------------------------------------
> 
> Test Case:
> ----------
> create table templ_arg(accii int2,type char,sign float8);
> create table a1 () inherits (templ_arg);
> insert into a1 values (9999,'a',1); -- working;
> insert into a1 values (9999,'a',-1); -- ERROR;
> insert into a1 values (9999,'a',-1.0); --working
Yep, it is a bug, and I will add it to the TODO list.  In float8out, we
use:
	printf("%.*g", CONST, value)

and the %g is causing it to print as:

             equal to the precision.  Trailing zeros are removed from the
             fractional part of the result; a decimal point appears only if it
             is followed by at least one digit.

Now, what we should probably be doing is to allow -1 (without decimal
point) to be promoted to float8 in the INSERT, and I think we are going
to be able to do that in 6.4.

I know this is crummy, but I can't even think of a workaround for it.


-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-03-28 20:52:19
Subject: Re: [PORTS] Port Bug Report: pg_dump -d database >unload.file; cat unload.file|psql database ARE NOT EQUAL
Previous:From: Meskes, MichaelDate: 1998-03-28 19:25:33
Subject: RE: [HACKERS] Going on vacation

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