From 393f313227fba2b7905cfbd69b3e4c18d762bf4f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 21 Feb 2000 18:47:12 +0000 Subject: 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. --- src/backend/parser/parse_expr.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/backend/parser/parse_expr.c') diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 3fd3370672f..2efdd136005 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.69 2000/02/20 21:32:10 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.70 2000/02/21 18:47:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -726,23 +726,19 @@ parser_typecast_constant(Value *expr, TypeName *typename) switch (nodeTag(expr)) { - case T_String: - const_string = DatumGetPointer(expr->val.str); - break; case T_Integer: string_palloced = true; const_string = int4out(expr->val.ival); break; case T_Float: - string_palloced = true; - const_string = float8out(&expr->val.dval); + case T_String: + const_string = expr->val.str; break; case T_Null: isNull = true; break; default: - elog(ERROR, - "Cannot cast this expression to type '%s'", + elog(ERROR, "Cannot cast this expression to type '%s'", typename->name); } -- cgit v1.2.3