|
43 | 43 | #include"utils/typcache.h" |
44 | 44 |
|
45 | 45 |
|
46 | | -staticDatumextract_binary_interval_from_text(Datuminterval_text, |
47 | | -Oidpart_atttype, |
48 | | -Oid*interval_type); |
49 | | - |
50 | 46 | staticvoidextract_op_func_and_ret_type(char*opname,Oidtype1,Oidtype2, |
51 | 47 | Oid*move_bound_op_func, |
52 | 48 | Oid*move_bound_op_ret_type); |
@@ -427,64 +423,6 @@ create_partitions_for_value_internal(Oid relid, Datum value, Oid value_type) |
427 | 423 | returnpartid; |
428 | 424 | } |
429 | 425 |
|
430 | | -/* |
431 | | - * Convert interval from TEXT to binary form using partitioned column's type. |
432 | | - */ |
433 | | -staticDatum |
434 | | -extract_binary_interval_from_text(Datuminterval_text,/* interval as TEXT */ |
435 | | -Oidpart_atttype,/* partitioned column's type */ |
436 | | -Oid*interval_type)/* returned value */ |
437 | | -{ |
438 | | -Datuminterval_binary; |
439 | | -constchar*interval_cstring; |
440 | | - |
441 | | -interval_cstring=TextDatumGetCString(interval_text); |
442 | | - |
443 | | -/* If 'part_atttype' is a *date type*, cast 'range_interval' to INTERVAL */ |
444 | | -if (is_date_type_internal(part_atttype)) |
445 | | -{ |
446 | | -int32interval_typmod=PATHMAN_CONFIG_interval_typmod; |
447 | | - |
448 | | -/* Convert interval from CSTRING to internal form */ |
449 | | -interval_binary=DirectFunctionCall3(interval_in, |
450 | | -CStringGetDatum(interval_cstring), |
451 | | -ObjectIdGetDatum(InvalidOid), |
452 | | -Int32GetDatum(interval_typmod)); |
453 | | -if (interval_type) |
454 | | -*interval_type=INTERVALOID; |
455 | | -} |
456 | | -/* Otherwise cast it to the partitioned column's type */ |
457 | | -else |
458 | | -{ |
459 | | -HeapTuplehtup; |
460 | | -Oidtypein_proc=InvalidOid; |
461 | | - |
462 | | -htup=SearchSysCache1(TYPEOID,ObjectIdGetDatum(part_atttype)); |
463 | | -if (HeapTupleIsValid(htup)) |
464 | | -{ |
465 | | -typein_proc= ((Form_pg_type)GETSTRUCT(htup))->typinput; |
466 | | -ReleaseSysCache(htup); |
467 | | -} |
468 | | -else |
469 | | -elog(ERROR,"Cannot find input function for type %u",part_atttype); |
470 | | - |
471 | | -/* |
472 | | - * Convert interval from CSTRING to 'prel->atttype'. |
473 | | - * |
474 | | - * Note: We pass 3 arguments in case |
475 | | - * 'typein_proc' also takes Oid & typmod. |
476 | | - */ |
477 | | -interval_binary=OidFunctionCall3(typein_proc, |
478 | | -CStringGetDatum(interval_cstring), |
479 | | -ObjectIdGetDatum(part_atttype), |
480 | | -Int32GetDatum(-1)); |
481 | | -if (interval_type) |
482 | | -*interval_type=part_atttype; |
483 | | -} |
484 | | - |
485 | | -returninterval_binary; |
486 | | -} |
487 | | - |
488 | 426 | /* |
489 | 427 | * Fetch binary operator by name and return it's function and ret type. |
490 | 428 | */ |
|