Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb2d9fbe

Browse files
committed
Work around broken strtod() that's present in many Solaris releases.
Thanks to Michael Fuhr for identifying the problem.
1 parent178ec6f commitb2d9fbe

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

‎src/backend/utils/adt/float.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.106 2004/08/04 21:34:02 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.107 2004/08/11 17:20:49 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -317,6 +317,18 @@ float4in(PG_FUNCTION_ARGS)
317317
errmsg("invalid input syntax for type real: \"%s\"",
318318
orig_num)));
319319
}
320+
#ifdefHAVE_BUGGY_SOLARIS_STRTOD
321+
else
322+
{
323+
/*
324+
* Many versions of Solaris have a bug wherein strtod sets endptr
325+
* to point one byte beyond the end of the string when given
326+
* "inf" or "infinity".
327+
*/
328+
if (endptr!=num&&endptr[-1]=='\0')
329+
endptr--;
330+
}
331+
#endif/* HAVE_BUGGY_SOLARIS_STRTOD */
320332

321333
/* skip trailing whitespace */
322334
while (*endptr!='\0'&&isspace((unsignedchar)*endptr))
@@ -482,6 +494,18 @@ float8in(PG_FUNCTION_ARGS)
482494
errmsg("invalid input syntax for type double precision: \"%s\"",
483495
orig_num)));
484496
}
497+
#ifdefHAVE_BUGGY_SOLARIS_STRTOD
498+
else
499+
{
500+
/*
501+
* Many versions of Solaris have a bug wherein strtod sets endptr
502+
* to point one byte beyond the end of the string when given
503+
* "inf" or "infinity".
504+
*/
505+
if (endptr!=num&&endptr[-1]=='\0')
506+
endptr--;
507+
}
508+
#endif/* HAVE_BUGGY_SOLARIS_STRTOD */
485509

486510
/* skip trailing whitespace */
487511
while (*endptr!='\0'&&isspace((unsignedchar)*endptr))

‎src/include/port/solaris.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/include/port/solaris.h,v 1.11 2004/03/15 03:29:22 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/src/include/port/solaris.h,v 1.12 2004/08/11 17:20:50 tgl Exp $ */
22

33
/*
44
* Sort this out for all operating systems some time. The __xxx
@@ -35,3 +35,10 @@
3535
#defineBYTE_ORDER LITTLE_ENDIAN
3636
#endif
3737
#endif
38+
39+
/*
40+
* Many versions of Solaris have broken strtod() --- see bug #4751182.
41+
* For the moment we just assume they all do; it's probably not worth
42+
* the trouble to add a configure test for this.
43+
*/
44+
#defineHAVE_BUGGY_SOLARIS_STRTOD

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp