dbTalk Databases Forums  

[BUGS] pg_dump and psql disagree on numerical precision (powerpc)

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] pg_dump and psql disagree on numerical precision (powerpc) in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Christof Petig
 
Posts: n/a

Default [BUGS] pg_dump and psql disagree on numerical precision (powerpc) - 11-14-2003 , 03:58 AM






I didn't believe it at first:

create table test ( x double precision);

insert into test values (0.3);

test=# select * from test;
x
-----
0.3

--
-- Data for TOC entry 3 (OID 53248)
-- Name: test; Type: TABLE DATA; Schema: public; Owner: christof
--
COPY test (x) FROM stdin;
0.29999999999999999
\.

psql --version
psql (PostgreSQL) 7.4RC1

\set
VERSION = 'PostgreSQL 7.4RC1 on powerpc-unknown-linux-gnu, compiled by
GCC powerpc-linux-gcc (GCC) 3.3.2 (Debian)'

pg_dump --version
pg_dump (PostgreSQL) 7.4RC1


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] pg_dump and psql disagree on numerical precision (powerpc) - 11-14-2003 , 09:05 AM






Christof Petig <christof (AT) petig-baender (DOT) de> writes:
Quote:
COPY test (x) FROM stdin;
0.29999999999999999
\.
This is not a bug; it's pg_dump trying to recreate the actual floating
point value as accurately as it can. See the discussion of
extra_float_digits from six months or a year back.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
  #3  
Old   
Christof Petig
 
Posts: n/a

Default Re: [BUGS] pg_dump and psql disagree on numerical precision (powerpc) - 11-14-2003 , 09:51 AM



Tom Lane schrieb:
Quote:
Christof Petig <christof (AT) petig-baender (DOT) de> writes:

COPY test (x) FROM stdin;
0.29999999999999999
\.


This is not a bug; it's pg_dump trying to recreate the actual floating
point value as accurately as it can. See the discussion of
extra_float_digits from six months or a year back.
Oh, I see (and generally appreciate). Thank you for reminding me.

Commenting out "set extra_float_digits=2" in pg_dump.c gives me the old
behaviour. Is it only me wishing for a command line parameter for
pg_dump to set desired precision?

Christof


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #4  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] pg_dump and psql disagree on numerical precision (powerpc) - 11-14-2003 , 10:27 AM



Christof Petig <christof (AT) petig-baender (DOT) de> writes:
Quote:
Commenting out "set extra_float_digits=2" in pg_dump.c gives me the old
behaviour. Is it only me wishing for a command line parameter for
pg_dump to set desired precision?
It seems to me that you should be using type NUMERIC if you think there
is a difference between 0.3 and 0.29999999999999999.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.