Skip to content

Commit d91baea

Browse files
committed
Ooops ... I had left some test coding in selfuncs.c that
failed on 'field < textconstant' ...
1 parent ca5c10f commit d91baea

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/backend/utils/adt/selfuncs.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.38 1999/08/09 03:16:45 tgl Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.39 1999/08/21 00:56:18 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -26,6 +26,7 @@
2626
#include "parser/parse_func.h"
2727
#include "parser/parse_oper.h"
2828
#include "utils/builtins.h"
29+
#include "utils/int8.h"
2930
#include "utils/lsyscache.h"
3031
#include "utils/syscache.h"
3132

@@ -460,22 +461,31 @@ convert_to_scale(Datum value, Oid typid,
460461
case INT4OID:
461462
*scaleval = (double) DatumGetInt32(value);
462463
return true;
463-
// case INT8OID:
464-
465-
464+
case INT8OID:
465+
*scaleval = (double) (* i8tod((int64 *) DatumGetPointer(value)));
466+
return true;
466467
case FLOAT4OID:
467468
*scaleval = (double) (* DatumGetFloat32(value));
468469
return true;
469470
case FLOAT8OID:
470471
*scaleval = (double) (* DatumGetFloat64(value));
471472
return true;
472-
// case NUMERICOID:
473-
473+
case NUMERICOID:
474+
*scaleval = (double) (* numeric_float8((Numeric) DatumGetPointer(value)));
475+
return true;
474476
case OIDOID:
475477
case REGPROCOID:
476478
/* we can treat OIDs as integers... */
477479
*scaleval = (double) DatumGetObjectId(value);
478480
return true;
481+
case TEXTOID:
482+
/*
483+
* Eventually this should get handled by somehow scaling as a
484+
* string value. For now, we need to call it out to avoid
485+
* falling into the default case, because there is a float8(text)
486+
* function declared in pg_proc that will do the wrong thing :-(
487+
*/
488+
break;
479489
default:
480490
{
481491
/* See whether there is a registered type-conversion function,

0 commit comments

Comments
 (0)