----------------------------------------------------------------------- * Type cast functions * ----------------------------------------------------------------------- */
| 1146 | * ----------------------------------------------------------------------- |
| 1147 | */ |
| 1148 | static |
| 1149 | inline |
| 1150 | int64 |
| 1151 | datum_int64_cast(Datum elt, Oid element_type) { |
| 1152 | switch(element_type){ |
| 1153 | case INT2OID: |
| 1154 | return (int64) DatumGetInt16(elt); break; |
| 1155 | case INT4OID: |
| 1156 | return (int64) DatumGetInt32(elt); break; |
| 1157 | case INT8OID: |
| 1158 | return elt; break; |
| 1159 | default: |
| 1160 | ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
| 1161 | errmsg("type is not supported"), |
| 1162 | errdetail("Arrays with element type %s are not supported.", |
| 1163 | format_type_be(element_type)))); |
| 1164 | break; |
| 1165 | } |
| 1166 | return 0; |
| 1167 | } |
| 1168 | |
| 1169 | static |
| 1170 | inline |