| 443 | */ |
| 444 | PG_FUNCTION_INFO_V1(array_mean); |
| 445 | Datum |
| 446 | array_mean(PG_FUNCTION_ARGS){ |
| 447 | if (PG_ARGISNULL(0)) { PG_RETURN_NULL(); } |
| 448 | |
| 449 | ArrayType *v = PG_GETARG_ARRAYTYPE_P(0); |
| 450 | |
| 451 | Datum res = General_Array_to_Element(v, Float8GetDatum(0), 0.0, |
| 452 | element_sum, average_finalize); |
| 453 | |
| 454 | PG_FREE_IF_COPY(v, 0); |
| 455 | |
| 456 | return(res); |
| 457 | } |
| 458 | |
| 459 | /* |
| 460 | * This function returns sum of the array elements, typed float8. |
nothing calls this directly
no test coverage detected