Skip to content

Commit 59f2971

Browse files
committed
Fixes:
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 <maillist@candle.pha.pa.us>
1 parent 9b7eb28 commit 59f2971

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/backend/parser/gram.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.5 1996/08/06 16:43:06 scrappy Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.6 1996/08/13 01:29:33 scrappy Exp $
1414
*
1515
* HISTORY
1616
* AUTHOR DATE MAJOR EVENT
@@ -2112,7 +2112,7 @@ xlateSqlType(char *name)
21122112
return "int2";
21132113
else if (!strcasecmp(name, "float") ||
21142114
!strcasecmp(name, "real"))
2115-
return "float4";
2115+
return "float8";
21162116
else
21172117
return name;
21182118
}

src/backend/parser/parse_query.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.2 1996/07/19 07:24:09 scrappy Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.3 1996/08/13 01:29:34 scrappy Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -594,13 +594,13 @@ make_const(Value *value)
594594

595595
case T_Float:
596596
{
597-
float32 dummy;
598-
tp = type("float4");
597+
float64 dummy;
598+
tp = type("float8");
599599

600-
dummy = (float32)palloc(sizeof(float32data));
600+
dummy = (float64)palloc(sizeof(float64data));
601601
*dummy = floatVal(value);
602602

603-
val = Float32GetDatum(dummy);
603+
val = Float64GetDatum(dummy);
604604
}
605605
break;
606606

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy