* array_fill * Create and fill array with default lower bounds. */
| 5912 | * Create and fill array with default lower bounds. |
| 5913 | */ |
| 5914 | Datum |
| 5915 | array_fill(PG_FUNCTION_ARGS) |
| 5916 | { |
| 5917 | ArrayType *dims; |
| 5918 | ArrayType *result; |
| 5919 | Oid elmtype; |
| 5920 | Datum value; |
| 5921 | bool isnull; |
| 5922 | |
| 5923 | if (PG_ARGISNULL(1)) |
| 5924 | ereport(ERROR, |
| 5925 | (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), |
| 5926 | errmsg("dimension array or low bound array cannot be null"))); |
| 5927 | |
| 5928 | dims = PG_GETARG_ARRAYTYPE_P(1); |
| 5929 | |
| 5930 | if (!PG_ARGISNULL(0)) |
| 5931 | { |
| 5932 | value = PG_GETARG_DATUM(0); |
| 5933 | isnull = false; |
| 5934 | } |
| 5935 | else |
| 5936 | { |
| 5937 | value = 0; |
| 5938 | isnull = true; |
| 5939 | } |
| 5940 | |
| 5941 | elmtype = get_fn_expr_argtype(fcinfo->flinfo, 0); |
| 5942 | if (!OidIsValid(elmtype)) |
| 5943 | elog(ERROR, "could not determine data type of input"); |
| 5944 | |
| 5945 | result = array_fill_internal(dims, NULL, value, isnull, elmtype, fcinfo); |
| 5946 | PG_RETURN_ARRAYTYPE_P(result); |
| 5947 | } |
| 5948 | |
| 5949 | static ArrayType * |
| 5950 | create_array_envelope(int ndims, int *dimv, int *lbsv, int nbytes, |
nothing calls this directly
no test coverage detected