diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-02-21 18:47:12 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-02-21 18:47:12 +0000 |
commit | 393f313227fba2b7905cfbd69b3e4c18d762bf4f (patch) | |
tree | 0eab81bd6705a19b625880d9b5cefb1d50c78d78 /src/backend/nodes/outfuncs.c | |
parent | ee97d103ccf68ae45343caea4188ca3dd5ce7365 (diff) | |
download | postgresql-393f313227fba2b7905cfbd69b3e4c18d762bf4f.tar.gz postgresql-393f313227fba2b7905cfbd69b3e4c18d762bf4f.zip |
Change parse-time representation of float literals (which include oversize
integers) to be strings instead of 'double'. We convert from string form
to internal representation only after type resolution has determined the
correct type for the constant. This eliminates loss-of-precision worries
and gets rid of the change in behavior seen at 17 digits with the
previous kluge.
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r-- | src/backend/nodes/outfuncs.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index db785afab9f..eb2c1a7ffa8 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.109 2000/02/20 21:32:05 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.110 2000/02/21 18:47:00 tgl Exp $ * * NOTES * Every (plan) node in POSTGRES has an associated "out" routine which @@ -1265,16 +1265,19 @@ _outValue(StringInfo str, Value *value) { switch (value->type) { - case T_String: - appendStringInfo(str, " \""); - _outToken(str, value->val.str); - appendStringInfo(str, "\" "); - break; case T_Integer: appendStringInfo(str, " %ld ", value->val.ival); break; case T_Float: - appendStringInfo(str, " %.17g ", value->val.dval); + /* We assume the value is a valid numeric literal + * and so does not need quoting. + */ + appendStringInfo(str, " %s ", value->val.str); + break; + case T_String: + appendStringInfo(str, " \""); + _outToken(str, value->val.str); + appendStringInfo(str, "\" "); break; default: elog(NOTICE, "_outValue: don't know how to print type %d ", |