Fixes:
authorMarc G. Fournier
Tue, 13 Aug 1996 01:29:34 +0000 (01:29 +0000)
committerMarc G. Fournier
Tue, 13 Aug 1996 01:29:34 +0000 (01:29 +0000)
This patch forces postgres95 to assume any floating-point value is a
float8.  It removes the requirement that you cast all floating-point
constants to float8.

We can remove alot of casts in the regression test after we are sure
this works.

If I have missed anything, would someone let me know.  I have tested
inserts of floating-point values into float8 fields, and it worked well.
Casting the number to float4 showed the same precision loss as previous
uncast values showed.

Submitted by: Bruce Momjian 

src/backend/parser/gram.y
src/backend/parser/parse_query.c

index 65ecfc376a660c73f7e83e8c86494449862955ce..517c1a64edf6cdab5830124ae4f163ad86122200 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.5 1996/08/06 16:43:06 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.6 1996/08/13 01:29:33 scrappy Exp $
  *
  * HISTORY
  *    AUTHOR       DATE        MAJOR EVENT
@@ -2112,7 +2112,7 @@ xlateSqlType(char *name)
    return "int2";
     else if (!strcasecmp(name, "float") ||
         !strcasecmp(name, "real"))
-   return "float4";
+   return "float8";
     else
    return name;
 }
index 974238aed47ba053a500929226a85ded41147b0c..600b7e78784aa163222b43d706c00eead829b07c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.2 1996/07/19 07:24:09 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.3 1996/08/13 01:29:34 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -594,13 +594,13 @@ make_const(Value *value)
    
     case T_Float:
    {
-       float32 dummy;
-       tp = type("float4");
+       float64 dummy;
+       tp = type("float8");
        
-       dummy = (float32)palloc(sizeof(float32data));
+       dummy = (float64)palloc(sizeof(float64data));
        *dummy = floatVal(value);
        
-       val = Float32GetDatum(dummy);
+       val = Float64GetDatum(dummy);
    }
    break;