|
10 | 10 | *
|
11 | 11 | *
|
12 | 12 | * 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 $ |
14 | 14 | *
|
15 | 15 | *-------------------------------------------------------------------------
|
16 | 16 | */
|
|
26 | 26 | #include"parser/parse_func.h"
|
27 | 27 | #include"parser/parse_oper.h"
|
28 | 28 | #include"utils/builtins.h"
|
| 29 | +#include"utils/int8.h" |
29 | 30 | #include"utils/lsyscache.h"
|
30 | 31 | #include"utils/syscache.h"
|
31 | 32 |
|
@@ -460,22 +461,31 @@ convert_to_scale(Datum value, Oid typid,
|
460 | 461 | caseINT4OID:
|
461 | 462 | *scaleval= (double)DatumGetInt32(value);
|
462 | 463 | return true;
|
463 |
| -//case INT8OID: |
464 |
| - |
465 |
| - |
| 464 | +caseINT8OID: |
| 465 | +*scaleval= (double) (*i8tod((int64*)DatumGetPointer(value))); |
| 466 | +return true; |
466 | 467 | caseFLOAT4OID:
|
467 | 468 | *scaleval= (double) (*DatumGetFloat32(value));
|
468 | 469 | return true;
|
469 | 470 | caseFLOAT8OID:
|
470 | 471 | *scaleval= (double) (*DatumGetFloat64(value));
|
471 | 472 | return true;
|
472 |
| -//case NUMERICOID: |
473 |
| - |
| 473 | +caseNUMERICOID: |
| 474 | +*scaleval= (double) (*numeric_float8((Numeric)DatumGetPointer(value))); |
| 475 | +return true; |
474 | 476 | caseOIDOID:
|
475 | 477 | caseREGPROCOID:
|
476 | 478 | /* we can treat OIDs as integers... */
|
477 | 479 | *scaleval= (double)DatumGetObjectId(value);
|
478 | 480 | return true;
|
| 481 | +caseTEXTOID: |
| 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; |
479 | 489 | default:
|
480 | 490 | {
|
481 | 491 | /* See whether there is a registered type-conversion function,
|
|