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

Commit5c63975

Browse files
committed
Float-to-int conversion functions should return NULL when given NULL
input, not throw a gratuitous elog().
1 parent37ab088 commit5c63975

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.54 2000/03/14 23:06:36 thomas Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.55 2000/03/23 07:40:00 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -830,8 +830,8 @@ dtoi4(float64 num)
830830
{
831831
int32result;
832832

833-
if (!PointerIsValid(num))
834-
elog(ERROR,"dtoi4: unable to convert null");
833+
if (!num)
834+
return0;/* fmgr will return NULL anyway */
835835

836836
if ((*num<INT_MIN)|| (*num>INT_MAX))
837837
elog(ERROR,"dtoi4: integer out of range");
@@ -849,8 +849,8 @@ dtoi2(float64 num)
849849
{
850850
int16result;
851851

852-
if (!PointerIsValid(num))
853-
elog(ERROR,"dtoi2: unable to convert null");
852+
if (!num)
853+
return0;/* fmgr will return NULL anyway */
854854

855855
if ((*num<SHRT_MIN)|| (*num>SHRT_MAX))
856856
elog(ERROR,"dtoi2: integer out of range");
@@ -898,8 +898,8 @@ ftoi4(float32 num)
898898
{
899899
int32result;
900900

901-
if (!PointerIsValid(num))
902-
elog(ERROR,"ftoi4: unable to convert null");
901+
if (!num)
902+
return0;/* fmgr will return NULL anyway */
903903

904904
if ((*num<INT_MIN)|| (*num>INT_MAX))
905905
elog(ERROR,"ftoi4: integer out of range");
@@ -917,8 +917,8 @@ ftoi2(float32 num)
917917
{
918918
int16result;
919919

920-
if (!PointerIsValid(num))
921-
elog(ERROR,"ftoi2: unable to convert null");
920+
if (!num)
921+
return0;/* fmgr will return NULL anyway */
922922

923923
if ((*num<SHRT_MIN)|| (*num>SHRT_MAX))
924924
elog(ERROR,"ftoi2: integer out of range");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp