| 1221 | } |
| 1222 | |
| 1223 | static |
| 1224 | inline |
| 1225 | Datum |
| 1226 | float8_datum_cast(float8 res, Oid result_type) { |
| 1227 | Datum result = Float8GetDatum(res); |
| 1228 | switch(result_type){ |
| 1229 | case INT2OID: |
| 1230 | return DirectFunctionCall1(dtoi2, result); break; |
| 1231 | case INT4OID: |
| 1232 | return DirectFunctionCall1(dtoi4, result); break; |
| 1233 | case INT8OID: |
| 1234 | return DirectFunctionCall1(dtoi8, result); break; |
| 1235 | case FLOAT4OID: |
| 1236 | return DirectFunctionCall1(dtof, result); break; |
| 1237 | case FLOAT8OID: |
| 1238 | return result; break; |
| 1239 | case NUMERICOID: |
| 1240 | return DirectFunctionCall1(float8_numeric, result); break; |
| 1241 | default: |
| 1242 | ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
| 1243 | errmsg("type is not supported"), |
| 1244 | errdetail("Arrays with element type %s are not supported.", |
| 1245 | format_type_be(result_type)))); |
| 1246 | break; |
| 1247 | } |
| 1248 | return result; |
| 1249 | } |
| 1250 | |
| 1251 | /* |
| 1252 | * Template for element-wise help functions |
no outgoing calls
no test coverage detected