From: SourceForge.net <no...@so...> - 2004-10-28 13:06:06
|
Bugs item #1056030, was opened at 2004-10-28 13:29 Message generated for change (Comment added) made by peergriebel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=1056030&group_id=16528 Category: libpq Group: None Status: Open Resolution: None Priority: 5 Submitted By: Peer (peergriebel) Assigned to: Nobody/Anonymous (nobody) Summary: Numeric datatype loses digits Initial Comment: select * from table results in data rows. If the table includes numeric columns digits are truncated: 4.56 will be returned as 4.6. This does not happen using a statement like this: select * from table order by somecolumn ---------------------------------------------------------------------- >Comment By: Peer (peergriebel) Date: 2004-10-28 15:06 Message: Logged In: YES user_id=1133977 After some investigation I discovered some more facts. You need: 0. (Use PgSQL 1.35) 1. A table with at least one numeric column (no precision, no scale) 2. Insert data with different precision. E.g 3.1 and 4.56. 3. SELECT all rows from db with different ordering so that first value (3.1) will be returned first/with second value (4.56) returned first. Then PgSQL tries to determine the precision of the numeric column. Since the databse does not tell it tries to guess (line #2859). It will guess by first value. So if 3.1 comes first it guesses precision is 1. BUT THIS IS WRONG. If the first fetched value is 4.56 it will guess precision is 2. Since the TypeCache uses it's knowlegde for all rows the guessing is sometimes wrong. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=1056030&group_id=16528 |