PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <ctype.h>
#include "access/htup_details.h"
#include "funcapi.h"
#include "libpq/pqformat.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/datum.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/typcache.h"
Go to the source code of this file.
Data Structures | |
struct | ArrayIteratorData |
struct | generate_subscripts_fctx |
Macros | |
#define | ASSGN "=" |
#define | APPENDSTR(str) (strcpy(p, (str)), p += strlen(p)) |
#define | APPENDCHAR(ch) (*p++ = (ch), *p = '\0') |
Typedefs | |
typedef struct ArrayIteratorData | ArrayIteratorData |
typedef struct generate_subscripts_fctx | generate_subscripts_fctx |
Functions | |
static bool | array_isspace (char ch) |
static int | ArrayCount (const char *str, int *dim, char typdelim) |
static void | ReadArrayStr (char *arrayStr, const char *origStr, int nitems, int ndim, int *dim, FmgrInfo *inputproc, Oid typioparam, int32 typmod, char typdelim, int typlen, bool typbyval, char typalign, Datum *values, bool *nulls, bool *hasnulls, int32 *nbytes) |
static void | ReadArrayBinary (StringInfo buf, int nitems, FmgrInfo *receiveproc, Oid typioparam, int32 typmod, int typlen, bool typbyval, char typalign, Datum *values, bool *nulls, bool *hasnulls, int32 *nbytes) |
static void | CopyArrayEls (ArrayType *array, Datum *values, bool *nulls, int nitems, int typlen, bool typbyval, char typalign, bool freedata) |
static bool | array_get_isnull (const bits8 *nullbitmap, int offset) |
static void | array_set_isnull (bits8 *nullbitmap, int offset, bool isNull) |
static Datum | ArrayCast (char *value, bool byval, int len) |
static int | ArrayCastAndSet (Datum src, int typlen, bool typbyval, char typalign, char *dest) |
static char * | array_seek (char *ptr, int offset, bits8 *nullbitmap, int nitems, int typlen, bool typbyval, char typalign) |
static int | array_nelems_size (char *ptr, int offset, bits8 *nullbitmap, int nitems, int typlen, bool typbyval, char typalign) |
static int | array_copy (char *destptr, int nitems, char *srcptr, int offset, bits8 *nullbitmap, int typlen, bool typbyval, char typalign) |
static int | array_slice_size (char *arraydataptr, bits8 *arraynullsptr, int ndim, int *dim, int *lb, int *st, int *endp, int typlen, bool typbyval, char typalign) |
static void | array_extract_slice (ArrayType *newarray, int ndim, int *dim, int *lb, char *arraydataptr, bits8 *arraynullsptr, int *st, int *endp, int typlen, bool typbyval, char typalign) |
static void | array_insert_slice (ArrayType *destArray, ArrayType *origArray, ArrayType *srcArray, int ndim, int *dim, int *lb, int *st, int *endp, int typlen, bool typbyval, char typalign) |
static int | array_cmp (FunctionCallInfo fcinfo) |
static ArrayType * | create_array_envelope (int ndims, int *dimv, int *lbv, int nbytes, Oid elmtype, int dataoffset) |
static ArrayType * | array_fill_internal (ArrayType *dims, ArrayType *lbs, Datum value, bool isnull, Oid elmtype, FunctionCallInfo fcinfo) |
static ArrayType * | array_replace_internal (ArrayType *array, Datum search, bool search_isnull, Datum replace, bool replace_isnull, bool remove, Oid collation, FunctionCallInfo fcinfo) |
Datum | array_in (PG_FUNCTION_ARGS) |
Datum | array_out (PG_FUNCTION_ARGS) |
Datum | array_recv (PG_FUNCTION_ARGS) |
Datum | array_send (PG_FUNCTION_ARGS) |
Datum | array_ndims (PG_FUNCTION_ARGS) |
Datum | array_dims (PG_FUNCTION_ARGS) |
Datum | array_lower (PG_FUNCTION_ARGS) |
Datum | array_upper (PG_FUNCTION_ARGS) |
Datum | array_length (PG_FUNCTION_ARGS) |
Datum | array_cardinality (PG_FUNCTION_ARGS) |
Datum | array_ref (ArrayType *array, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull) |
ArrayType * | array_get_slice (ArrayType *array, int nSubscripts, int *upperIndx, int *lowerIndx, int arraytyplen, int elmlen, bool elmbyval, char elmalign) |
ArrayType * | array_set (ArrayType *array, int nSubscripts, int *indx, Datum dataValue, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign) |
ArrayType * | array_set_slice (ArrayType *array, int nSubscripts, int *upperIndx, int *lowerIndx, ArrayType *srcArray, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign) |
Datum | array_map (FunctionCallInfo fcinfo, Oid inpType, Oid retType, ArrayMapState *amstate) |
ArrayType * | construct_array (Datum *elems, int nelems, Oid elmtype, int elmlen, bool elmbyval, char elmalign) |
ArrayType * | construct_md_array (Datum *elems, bool *nulls, int ndims, int *dims, int *lbs, Oid elmtype, int elmlen, bool elmbyval, char elmalign) |
ArrayType * | construct_empty_array (Oid elmtype) |
void | deconstruct_array (ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp) |
bool | array_contains_nulls (ArrayType *array) |
Datum | array_eq (PG_FUNCTION_ARGS) |
Datum | array_ne (PG_FUNCTION_ARGS) |
Datum | array_lt (PG_FUNCTION_ARGS) |
Datum | array_gt (PG_FUNCTION_ARGS) |
Datum | array_le (PG_FUNCTION_ARGS) |
Datum | array_ge (PG_FUNCTION_ARGS) |
Datum | btarraycmp (PG_FUNCTION_ARGS) |
Datum | hash_array (PG_FUNCTION_ARGS) |
static bool | array_contain_compare (ArrayType *array1, ArrayType *array2, Oid collation, bool matchall, void **fn_extra) |
Datum | arrayoverlap (PG_FUNCTION_ARGS) |
Datum | arraycontains (PG_FUNCTION_ARGS) |
Datum | arraycontained (PG_FUNCTION_ARGS) |
ArrayIterator | array_create_iterator (ArrayType *arr, int slice_ndim) |
bool | array_iterate (ArrayIterator iterator, Datum *value, bool *isnull) |
void | array_free_iterator (ArrayIterator iterator) |
void | array_bitmap_copy (bits8 *destbitmap, int destoffset, const bits8 *srcbitmap, int srcoffset, int nitems) |
ArrayBuildState * | accumArrayResult (ArrayBuildState *astate, Datum dvalue, bool disnull, Oid element_type, MemoryContext rcontext) |
Datum | makeArrayResult (ArrayBuildState *astate, MemoryContext rcontext) |
Datum | makeMdArrayResult (ArrayBuildState *astate, int ndims, int *dims, int *lbs, MemoryContext rcontext, bool release) |
Datum | array_larger (PG_FUNCTION_ARGS) |
Datum | array_smaller (PG_FUNCTION_ARGS) |
Datum | generate_subscripts (PG_FUNCTION_ARGS) |
Datum | generate_subscripts_nodir (PG_FUNCTION_ARGS) |
Datum | array_fill_with_lower_bounds (PG_FUNCTION_ARGS) |
Datum | array_fill (PG_FUNCTION_ARGS) |
Datum | array_unnest (PG_FUNCTION_ARGS) |
Datum | array_remove (PG_FUNCTION_ARGS) |
Datum | array_replace (PG_FUNCTION_ARGS) |
Variables | |
bool | Array_nulls = true |
#define APPENDCHAR | ( | ch | ) | (*p++ = (ch), *p = '\0') |
Referenced by array_out().
#define APPENDSTR | ( | str | ) | (strcpy(p, (str)), p += strlen(p)) |
Referenced by array_out().
#define ASSGN "=" |
Definition at line 38 of file arrayfuncs.c.
Referenced by array_in(), and array_out().
enum ArrayParseState |
ARRAY_NO_LEVEL | |
ARRAY_LEVEL_STARTED | |
ARRAY_ELEM_STARTED | |
ARRAY_ELEM_COMPLETED | |
ARRAY_QUOTED_ELEM_STARTED | |
ARRAY_QUOTED_ELEM_COMPLETED | |
ARRAY_ELEM_DELIMITED | |
ARRAY_LEVEL_COMPLETED | |
ARRAY_LEVEL_DELIMITED |
Definition at line 40 of file arrayfuncs.c.
ArrayBuildState* accumArrayResult | ( | ArrayBuildState * | astate, |
Datum | dvalue, | ||
bool | disnull, | ||
Oid | element_type, | ||
MemoryContext | rcontext | ||
) |
Definition at line 4568 of file arrayfuncs.c.
References ArrayBuildState::alen, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE, ALLOCSET_DEFAULT_MINSIZE, AllocSetContextCreate(), Assert, datumCopy(), ArrayBuildState::dnulls, ArrayBuildState::dvalues, ArrayBuildState::element_type, get_typlenbyvalalign(), ArrayBuildState::mcontext, MemoryContextSwitchTo(), ArrayBuildState::nelems, NULL, palloc(), PG_DETOAST_DATUM_COPY, PointerGetDatum, repalloc(), ArrayBuildState::typalign, ArrayBuildState::typbyval, and ArrayBuildState::typlen.
Referenced by array_agg_transfn(), array_to_datum_internal(), dblink_get_connections(), ExecScanSubPlan(), ExecSetParamPlan(), optionListToArray(), regexp_split_to_array(), text_to_array_internal(), and transformRelOptions().
void array_bitmap_copy | ( | bits8 * | destbitmap, |
int | destoffset, | ||
const bits8 * | srcbitmap, | ||
int | srcoffset, | ||
int | nitems | ||
) |
Definition at line 4264 of file arrayfuncs.c.
References Assert.
Referenced by array_cat(), array_extract_slice(), array_insert_slice(), array_set(), array_set_slice(), and ExecEvalArray().
Datum array_cardinality | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1747 of file arrayfuncs.c.
References ARR_DIMS, ARR_NDIM, ArrayGetNItems(), PG_GETARG_ARRAYTYPE_P, and PG_RETURN_INT32.
|
static |
Definition at line 3349 of file arrayfuncs.c.
References FunctionCallInfoData::arg, FunctionCallInfoData::argnull, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, ARR_NULLBITMAP, ArrayGetNItems(), att_addlength_pointer, att_align_nominal, TypeCacheEntry::cmp_proc_finfo, DatumGetInt32, ereport, errcode(), errmsg(), ERROR, fetch_att, FunctionCallInfoData::flinfo, FmgrInfo::fn_extra, FmgrInfo::fn_oid, format_type_be(), FunctionCallInvoke, i, InitFunctionCallInfoData, FunctionCallInfoData::isnull, lookup_type_cache(), Min, NULL, OidIsValid, PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_ARRAYTYPE_P, TypeCacheEntry::typalign, TypeCacheEntry::typbyval, TypeCacheEntry::type_id, TYPECACHE_CMP_PROC_FINFO, and TypeCacheEntry::typlen.
Referenced by array_ge(), array_gt(), array_larger(), array_le(), array_lt(), array_smaller(), and btarraycmp().
|
static |
Definition at line 3672 of file arrayfuncs.c.
References FunctionCallInfoData::arg, FunctionCallInfoData::argnull, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, ARR_NULLBITMAP, ArrayGetNItems(), att_addlength_pointer, att_align_nominal, DatumGetBool, deconstruct_array(), TypeCacheEntry::eq_opr_finfo, ereport, errcode(), errmsg(), ERROR, fetch_att, FmgrInfo::fn_oid, format_type_be(), FunctionCallInvoke, i, InitFunctionCallInfoData, FunctionCallInfoData::isnull, lookup_type_cache(), NULL, OidIsValid, pfree(), TypeCacheEntry::typalign, TypeCacheEntry::typbyval, TypeCacheEntry::type_id, TYPECACHE_EQ_OPR_FINFO, and TypeCacheEntry::typlen.
Referenced by arraycontained(), arraycontains(), and arrayoverlap().
Definition at line 3096 of file arrayfuncs.c.
References ARR_DIMS, ARR_HASNULL, ARR_NDIM, ARR_NULLBITMAP, and ArrayGetNItems().
Referenced by _arrq_cons(), _lca(), _lt_q_regex(), _ltree_compress(), array_fill_internal(), array_iterator(), ArrayGetIntegerTypmods(), arrq_cons(), cube_a_f8(), cube_a_f8_f8(), cube_subset(), get_path_all(), getWeights(), and lt_q_regex().
|
static |
Definition at line 4234 of file arrayfuncs.c.
References array_nelems_size().
Referenced by array_extract_slice(), and array_insert_slice().
ArrayIterator array_create_iterator | ( | ArrayType * | arr, |
int | slice_ndim | ||
) |
Definition at line 3905 of file arrayfuncs.c.
References ArrayIteratorData::arr, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_LBOUND, ARR_NDIM, ARR_NULLBITMAP, ArrayGetNItems(), Assert, ArrayIteratorData::current_item, ArrayIteratorData::data_ptr, elog, ERROR, get_typlenbyvalalign(), ArrayIteratorData::nitems, ArrayIteratorData::nullbitmap, palloc(), palloc0(), PointerIsValid, ArrayIteratorData::slice_dims, ArrayIteratorData::slice_lbound, ArrayIteratorData::slice_len, ArrayIteratorData::slice_ndim, ArrayIteratorData::slice_nulls, ArrayIteratorData::slice_values, ArrayIteratorData::typalign, ArrayIteratorData::typbyval, and ArrayIteratorData::typlen.
Referenced by exec_stmt_foreach_a().
Datum array_dims | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1625 of file arrayfuncs.c.
References ARR_DIMS, ARR_LBOUND, ARR_NDIM, buf, cstring_to_text(), i, MAXDIM, PG_GETARG_ARRAYTYPE_P, PG_RETURN_NULL, and PG_RETURN_TEXT_P.
Datum array_eq | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3143 of file arrayfuncs.c.
References FunctionCallInfoData::arg, FunctionCallInfoData::argnull, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, ARR_NULLBITMAP, ArrayGetNItems(), att_addlength_pointer, att_align_nominal, DatumGetBool, TypeCacheEntry::eq_opr_finfo, ereport, errcode(), errmsg(), ERROR, fetch_att, FmgrInfo::fn_oid, format_type_be(), FunctionCallInvoke, i, InitFunctionCallInfoData, FunctionCallInfoData::isnull, lookup_type_cache(), NULL, OidIsValid, PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_ARRAYTYPE_P, PG_RETURN_BOOL, TypeCacheEntry::typalign, TypeCacheEntry::typbyval, TypeCacheEntry::type_id, TYPECACHE_EQ_OPR_FINFO, and TypeCacheEntry::typlen.
Referenced by array_ne().
|
static |
Definition at line 4395 of file arrayfuncs.c.
References ARR_DATA_PTR, ARR_NULLBITMAP, array_bitmap_copy(), array_copy(), array_seek(), ArrayGetOffset(), i, MAXDIM, mda_get_offset_values(), mda_get_prod(), mda_get_range(), and mda_next_tuple().
Referenced by array_get_slice().
Datum array_fill | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4860 of file arrayfuncs.c.
References array_fill_internal(), elog, ereport, errcode(), errmsg(), ERROR, get_fn_expr_argtype(), NULL, OidIsValid, PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_DATUM, PG_RETURN_ARRAYTYPE_P, and value.
|
static |
Definition at line 4912 of file arrayfuncs.c.
References AllocSizeIsValid, ARR_DATA_PTR, ARR_DIMS, ARR_LBOUND, ARR_NDIM, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, array_contains_nulls(), ArrayCastAndSet(), ArrayGetNItems(), Assert, att_addlength_datum, att_align_nominal, construct_empty_array(), create_array_envelope(), ArrayMetaState::element_type, ereport, errcode(), errdetail(), errmsg(), ERROR, FunctionCallInfoData::flinfo, FmgrInfo::fn_extra, FmgrInfo::fn_mcxt, get_typlenbyvalalign(), i, InvalidOid, MaxAllocSize, MAXDIM, MemoryContextAlloc(), NULL, PG_DETOAST_DATUM, PointerGetDatum, ArrayMetaState::typalign, ArrayMetaState::typbyval, and ArrayMetaState::typlen.
Referenced by array_fill(), and array_fill_with_lower_bounds().
Datum array_fill_with_lower_bounds | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4819 of file arrayfuncs.c.
References array_fill_internal(), elog, ereport, errcode(), errmsg(), ERROR, get_fn_expr_argtype(), OidIsValid, PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_DATUM, PG_RETURN_ARRAYTYPE_P, and value.
void array_free_iterator | ( | ArrayIterator | iterator | ) |
Definition at line 4057 of file arrayfuncs.c.
References pfree(), ArrayIteratorData::slice_ndim, ArrayIteratorData::slice_nulls, and ArrayIteratorData::slice_values.
Referenced by exec_stmt_foreach_a().
Datum array_ge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3331 of file arrayfuncs.c.
References array_cmp(), and PG_RETURN_BOOL.
Definition at line 4079 of file arrayfuncs.c.
References NULL.
Referenced by array_iterate(), array_ref(), array_set(), array_slice_size(), and array_unnest().
ArrayType* array_get_slice | ( | ArrayType * | array, |
int | nSubscripts, | ||
int * | upperIndx, | ||
int * | lowerIndx, | ||
int | arraytyplen, | ||
int | elmlen, | ||
bool | elmbyval, | ||
char | elmalign | ||
) |
Definition at line 1886 of file arrayfuncs.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_LBOUND, ARR_NDIM, ARR_NULLBITMAP, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, array_extract_slice(), array_slice_size(), ArrayGetNItems(), construct_empty_array(), ArrayType::dataoffset, DatumGetArrayTypeP, ArrayType::elemtype, ereport, errcode(), errmsg(), ERROR, i, InvalidOid, MAXDIM, mda_get_range(), ArrayType::ndim, NULL, palloc0(), PointerGetDatum, and SET_VARSIZE.
Referenced by ExecEvalArrayRef().
Datum array_gt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3319 of file arrayfuncs.c.
References array_cmp(), and PG_RETURN_BOOL.
Datum array_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 144 of file arrayfuncs.c.
References ARR_DIMS, ARR_LBOUND, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, array_isspace(), ArrayCount(), ArrayGetNItems(), ASSGN, construct_empty_array(), CopyArrayEls(), ArrayType::dataoffset, ArrayMetaState::element_type, ArrayType::elemtype, ereport, errcode(), errmsg(), ERROR, fmgr_info_cxt(), FmgrInfo::fn_mcxt, get_type_io_data(), i, IOFunc_input, MAXDIM, MemoryContextAlloc(), ArrayType::ndim, NULL, palloc(), palloc0(), pfree(), PG_GETARG_CSTRING, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_ARRAYTYPE_P, ArrayMetaState::proc, pstrdup(), ReadArrayStr(), SET_VARSIZE, ArrayMetaState::typalign, ArrayMetaState::typbyval, ArrayMetaState::typdelim, ArrayMetaState::typiofunc, ArrayMetaState::typioparam, and ArrayMetaState::typlen.
|
static |
Definition at line 4468 of file arrayfuncs.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_NDIM, ARR_NULLBITMAP, array_bitmap_copy(), array_copy(), array_seek(), ArrayGetNItems(), ArrayGetOffset(), i, MAXDIM, mda_get_offset_values(), mda_get_prod(), mda_get_range(), and mda_next_tuple().
Referenced by array_set_slice().
|
static |
Definition at line 392 of file arrayfuncs.c.
Referenced by array_in(), array_out(), ArrayCount(), and ReadArrayStr().
bool array_iterate | ( | ArrayIterator | iterator, |
Datum * | value, | ||
bool * | isnull | ||
) |
Definition at line 3974 of file arrayfuncs.c.
References ArrayIteratorData::arr, ARR_ELEMTYPE, array_get_isnull(), att_addlength_pointer, att_align_nominal, construct_md_array(), ArrayIteratorData::current_item, ArrayIteratorData::data_ptr, fetch_att, i, ArrayIteratorData::nitems, ArrayIteratorData::nullbitmap, PointerGetDatum, ArrayIteratorData::slice_dims, ArrayIteratorData::slice_lbound, ArrayIteratorData::slice_len, ArrayIteratorData::slice_ndim, ArrayIteratorData::slice_nulls, ArrayIteratorData::slice_values, ArrayIteratorData::typalign, ArrayIteratorData::typbyval, ArrayIteratorData::typlen, and values.
Referenced by exec_stmt_foreach_a().
Datum array_larger | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4702 of file arrayfuncs.c.
References array_cmp(), PG_GETARG_ARRAYTYPE_P, and PG_RETURN_ARRAYTYPE_P.
Datum array_le | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3325 of file arrayfuncs.c.
References array_cmp(), and PG_RETURN_BOOL.
Datum array_length | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1720 of file arrayfuncs.c.
References ARR_DIMS, ARR_NDIM, MAXDIM, PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_RETURN_INT32, and PG_RETURN_NULL.
Datum array_lower | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1663 of file arrayfuncs.c.
References ARR_LBOUND, ARR_NDIM, MAXDIM, PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_RETURN_INT32, and PG_RETURN_NULL.
Datum array_lt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3313 of file arrayfuncs.c.
References array_cmp(), and PG_RETURN_BOOL.
Datum array_map | ( | FunctionCallInfo | fcinfo, |
Oid | inpType, | ||
Oid | retType, | ||
ArrayMapState * | amstate | ||
) |
Definition at line 2665 of file arrayfuncs.c.
References AllocSizeIsValid, FunctionCallInfoData::arg, FunctionCallInfoData::argnull, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, ARR_NULLBITMAP, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, ArrayGetNItems(), Assert, att_addlength_datum, att_align_nominal, construct_empty_array(), CopyArrayEls(), ArrayType::dataoffset, ArrayMetaState::element_type, ArrayType::elemtype, elog, ereport, errcode(), errmsg(), ERROR, fetch_att, FunctionCallInfoData::flinfo, FmgrInfo::fn_strict, FunctionCallInvoke, get_typlenbyvalalign(), i, ArrayMapState::inp_extra, FunctionCallInfoData::isnull, MaxAllocSize, FunctionCallInfoData::nargs, ArrayType::ndim, palloc(), palloc0(), pfree(), PG_ARGISNULL, PG_DETOAST_DATUM, PG_GETARG_ARRAYTYPE_P, PG_RETURN_ARRAYTYPE_P, PointerGetDatum, ArrayMapState::ret_extra, SET_VARSIZE, ArrayMetaState::typalign, ArrayMetaState::typbyval, ArrayMetaState::typlen, and values.
Referenced by ExecEvalArrayCoerceExpr().
Datum array_ndims | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1609 of file arrayfuncs.c.
References ARR_NDIM, MAXDIM, PG_GETARG_ARRAYTYPE_P, PG_RETURN_INT32, and PG_RETURN_NULL.
Datum array_ne | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3307 of file arrayfuncs.c.
References array_eq(), DatumGetBool, and PG_RETURN_BOOL.
|
static |
Definition at line 4212 of file arrayfuncs.c.
References array_seek().
Referenced by array_copy(), and array_set_slice().
Datum array_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 956 of file arrayfuncs.c.
References APPENDCHAR, APPENDSTR, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_LBOUND, ARR_NDIM, ARR_NULLBITMAP, array_isspace(), ArrayGetNItems(), ASSGN, att_addlength_pointer, att_align_nominal, ArrayMetaState::element_type, fetch_att, fmgr_info_cxt(), FmgrInfo::fn_mcxt, get_type_io_data(), i, IOFunc_output, MAXDIM, MemoryContextAlloc(), NULL, OutputFunctionCall(), palloc(), pfree(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_CSTRING, pg_strcasecmp(), ArrayMetaState::proc, pstrdup(), ArrayMetaState::typalign, ArrayMetaState::typbyval, ArrayMetaState::typdelim, ArrayMetaState::typiofunc, ArrayMetaState::typioparam, ArrayMetaState::typlen, and values.
Referenced by anyarray_out().
Datum array_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1213 of file arrayfuncs.c.
References ARR_DIMS, ARR_LBOUND, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, ArrayGetNItems(), buf, construct_empty_array(), CopyArrayEls(), ArrayType::dataoffset, ArrayMetaState::element_type, ArrayType::elemtype, ereport, errcode(), errmsg(), ERROR, fmgr_info_cxt(), FmgrInfo::fn_mcxt, format_type_be(), get_type_io_data(), i, IOFunc_receive, MAXDIM, MemoryContextAlloc(), ArrayType::ndim, NULL, OidIsValid, palloc(), palloc0(), pfree(), PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_ARRAYTYPE_P, pq_getmsgint(), ArrayMetaState::proc, ReadArrayBinary(), SET_VARSIZE, ArrayMetaState::typalign, ArrayMetaState::typbyval, ArrayMetaState::typdelim, ArrayMetaState::typiofunc, ArrayMetaState::typioparam, and ArrayMetaState::typlen.
Referenced by int2vectorrecv(), and oidvectorrecv().
Datum array_ref | ( | ArrayType * | array, |
int | nSubscripts, | ||
int * | indx, | ||
int | arraytyplen, | ||
int | elmlen, | ||
bool | elmbyval, | ||
char | elmalign, | ||
bool * | isNull | ||
) |
Definition at line 1776 of file arrayfuncs.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_LBOUND, ARR_NDIM, ARR_NULLBITMAP, array_get_isnull(), array_seek(), ArrayCast(), ArrayGetOffset(), DatumGetArrayTypeP, i, MAXDIM, NULL, and PointerGetDatum.
Referenced by ExecEvalArrayRef(), GUCArrayAdd(), GUCArrayDelete(), GUCArrayReset(), pg_get_functiondef(), PLyList_FromArray(), and ProcessGUCArray().
Datum array_remove | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5463 of file arrayfuncs.c.
References array_replace_internal(), PG_ARGISNULL, PG_GET_COLLATION, PG_GETARG_ARRAYTYPE_P, PG_GETARG_DATUM, PG_RETURN_ARRAYTYPE_P, and PG_RETURN_NULL.
Datum array_replace | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5485 of file arrayfuncs.c.
References array_replace_internal(), PG_ARGISNULL, PG_GET_COLLATION, PG_GETARG_ARRAYTYPE_P, PG_GETARG_DATUM, PG_RETURN_ARRAYTYPE_P, and PG_RETURN_NULL.
|
static |
Definition at line 5206 of file arrayfuncs.c.
References AllocSizeIsValid, FunctionCallInfoData::arg, FunctionCallInfoData::argnull, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, ARR_NULLBITMAP, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, ArrayGetNItems(), att_addlength_datum, att_align_nominal, construct_empty_array(), CopyArrayEls(), ArrayType::dataoffset, DatumGetBool, ArrayType::elemtype, TypeCacheEntry::eq_opr_finfo, ereport, errcode(), errmsg(), ERROR, fetch_att, FunctionCallInfoData::flinfo, FmgrInfo::fn_extra, FmgrInfo::fn_oid, format_type_be(), FunctionCallInvoke, i, InitFunctionCallInfoData, FunctionCallInfoData::isnull, lookup_type_cache(), MaxAllocSize, ArrayType::ndim, NULL, OidIsValid, palloc(), palloc0(), pfree(), PG_DETOAST_DATUM, PointerGetDatum, SET_VARSIZE, skip(), TypeCacheEntry::typalign, TypeCacheEntry::typbyval, TypeCacheEntry::type_id, TYPECACHE_EQ_OPR_FINFO, TypeCacheEntry::typlen, and values.
Referenced by array_remove(), and array_replace().
|
static |
Definition at line 4164 of file arrayfuncs.c.
References att_addlength_pointer, att_align_nominal, and i.
Referenced by array_extract_slice(), array_insert_slice(), array_nelems_size(), array_ref(), array_set(), and array_slice_size().
Datum array_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1493 of file arrayfuncs.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_LBOUND, ARR_NDIM, ARR_NULLBITMAP, ArrayGetNItems(), att_addlength_pointer, att_align_nominal, buf, ArrayMetaState::element_type, ereport, errcode(), errmsg(), ERROR, fetch_att, fmgr_info_cxt(), FmgrInfo::fn_mcxt, format_type_be(), get_type_io_data(), i, IOFunc_send, MemoryContextAlloc(), NULL, OidIsValid, pfree(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendbytes(), pq_sendint(), ArrayMetaState::proc, SendFunctionCall(), ArrayMetaState::typalign, ArrayMetaState::typbyval, ArrayMetaState::typdelim, ArrayMetaState::typiofunc, ArrayMetaState::typioparam, ArrayMetaState::typlen, VARDATA, VARHDRSZ, and VARSIZE.
Referenced by anyarray_send(), int2vectorsend(), and oidvectorsend().
ArrayType* array_set | ( | ArrayType * | array, |
int | nSubscripts, | ||
int * | indx, | ||
Datum | dataValue, | ||
bool | isNull, | ||
int | arraytyplen, | ||
int | elmlen, | ||
bool | elmbyval, | ||
char | elmalign | ||
) |
Definition at line 2052 of file arrayfuncs.c.
References ARR_DATA_OFFSET, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_LBOUND, ARR_NDIM, ARR_NULLBITMAP, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, ARR_SIZE, array_bitmap_copy(), array_get_isnull(), array_seek(), array_set_isnull(), ArrayCastAndSet(), ArrayGetNItems(), ArrayGetOffset(), att_addlength_datum, att_addlength_pointer, att_align_nominal, construct_md_array(), ArrayType::dataoffset, DatumGetArrayTypeP, ArrayType::elemtype, ereport, errcode(), errmsg(), ERROR, i, MAXDIM, MemSet, ArrayType::ndim, palloc(), palloc0(), PG_DETOAST_DATUM, PointerGetDatum, and SET_VARSIZE.
Referenced by array_push(), exec_assign_value(), ExecEvalArrayRef(), GUCArrayAdd(), GUCArrayDelete(), GUCArrayReset(), and pg_extension_config_dump().
Definition at line 4096 of file arrayfuncs.c.
Referenced by array_set().
ArrayType* array_set_slice | ( | ArrayType * | array, |
int | nSubscripts, | ||
int * | upperIndx, | ||
int * | lowerIndx, | ||
ArrayType * | srcArray, | ||
bool | isNull, | ||
int | arraytyplen, | ||
int | elmlen, | ||
bool | elmbyval, | ||
char | elmalign | ||
) |
Definition at line 2344 of file arrayfuncs.c.
References ARR_DATA_OFFSET, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_LBOUND, ARR_NDIM, ARR_NULLBITMAP, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, ARR_SIZE, array_bitmap_copy(), array_insert_slice(), array_nelems_size(), array_slice_size(), ArrayGetNItems(), Assert, construct_md_array(), ArrayType::dataoffset, DatumGetArrayTypeP, deconstruct_array(), ArrayType::elemtype, ereport, errcode(), errmsg(), ERROR, i, Max, MAXDIM, mda_get_range(), MemSet, Min, ArrayType::ndim, palloc0(), PointerGetDatum, and SET_VARSIZE.
Referenced by ExecEvalArrayRef().
|
static |
Definition at line 4335 of file arrayfuncs.c.
References array_get_isnull(), array_seek(), ArrayGetNItems(), ArrayGetOffset(), att_addlength_pointer, att_align_nominal, i, MAXDIM, mda_get_offset_values(), mda_get_prod(), mda_get_range(), and mda_next_tuple().
Referenced by array_get_slice(), and array_set_slice().
Datum array_smaller | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4717 of file arrayfuncs.c.
References array_cmp(), PG_GETARG_ARRAYTYPE_P, and PG_RETURN_ARRAYTYPE_P.
Datum array_unnest | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5091 of file arrayfuncs.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, ARR_NULLBITMAP, array_get_isnull(), ArrayCast(), ArrayGetNItems(), att_addlength_pointer, att_align_nominal, get_typlenbyvalalign(), MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, palloc(), PG_GETARG_ARRAYTYPE_P, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, and FuncCallContext::user_fctx.
Datum array_upper | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1690 of file arrayfuncs.c.
References ARR_DIMS, ARR_LBOUND, ARR_NDIM, MAXDIM, PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_RETURN_INT32, and PG_RETURN_NULL.
Definition at line 4114 of file arrayfuncs.c.
References fetch_att.
Referenced by array_ref(), and array_unnest().
|
static |
Definition at line 4125 of file arrayfuncs.c.
References Assert, att_addlength_datum, att_align_nominal, DatumGetPointer, memmove, and store_att_byval.
Referenced by array_fill_internal(), array_set(), and CopyArrayEls().
Datum arraycontained | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3868 of file arrayfuncs.c.
References array_contain_compare(), PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_ARRAYTYPE_P, and PG_RETURN_BOOL.
Datum arraycontains | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3850 of file arrayfuncs.c.
References array_contain_compare(), PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_ARRAYTYPE_P, and PG_RETURN_BOOL.
|
static |
Definition at line 412 of file arrayfuncs.c.
References ARRAY_ELEM_COMPLETED, ARRAY_ELEM_DELIMITED, ARRAY_ELEM_STARTED, array_isspace(), ARRAY_LEVEL_COMPLETED, ARRAY_LEVEL_DELIMITED, ARRAY_LEVEL_STARTED, ARRAY_NO_LEVEL, ARRAY_QUOTED_ELEM_COMPLETED, ARRAY_QUOTED_ELEM_STARTED, ereport, errcode(), errmsg(), ERROR, i, and MAXDIM.
Referenced by array_in().
Datum arrayoverlap | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3832 of file arrayfuncs.c.
References array_contain_compare(), PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_ARRAYTYPE_P, and PG_RETURN_BOOL.
Datum btarraycmp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3337 of file arrayfuncs.c.
References array_cmp(), and PG_RETURN_INT32.
ArrayType* construct_array | ( | Datum * | elems, |
int | nelems, | ||
Oid | elmtype, | ||
int | elmlen, | ||
bool | elmbyval, | ||
char | elmalign | ||
) |
Definition at line 2877 of file arrayfuncs.c.
References construct_md_array(), and NULL.
Referenced by build_regtype_array(), CreateConstraintEntry(), current_schemas(), enum_range_internal(), extension_config_remove(), filter_list_to_array(), float4_accum(), float8_accum(), float8_regr_accum(), get_available_versions_for_extension(), GUCArrayAdd(), GUCArrayDelete(), GUCArrayReset(), hstore_akeys(), interpret_function_parameter_list(), interval_accum(), pg_extension_config_dump(), show_trgm(), ts_lexize(), typenameTypeMod(), and update_attstats().
Definition at line 2995 of file arrayfuncs.c.
References ArrayType::dataoffset, ArrayType::elemtype, ArrayType::ndim, palloc0(), and SET_VARSIZE.
Referenced by array_fill_internal(), array_get_slice(), array_in(), array_map(), array_push(), array_recv(), array_replace_internal(), construct_md_array(), exec_assign_value(), ExecEvalArray(), ExecEvalArrayRef(), ExecScanSubPlan(), ExecSetParamPlan(), hstore_akeys(), hstore_avals(), hstore_slice_to_array(), hstore_to_array_internal(), percentile_cont_multi_final_common(), percentile_disc_multi_final(), plperl_array_to_datum(), text_to_array_internal(), transformGenericOptions(), and xpath().
ArrayType* construct_md_array | ( | Datum * | elems, |
bool * | nulls, | ||
int | ndims, | ||
int * | dims, | ||
int * | lbs, | ||
Oid | elmtype, | ||
int | elmlen, | ||
bool | elmbyval, | ||
char | elmalign | ||
) |
Definition at line 2911 of file arrayfuncs.c.
References AllocSizeIsValid, ARR_DIMS, ARR_LBOUND, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, ArrayGetNItems(), att_addlength_datum, att_align_nominal, construct_empty_array(), CopyArrayEls(), ArrayType::dataoffset, ArrayType::elemtype, ereport, errcode(), errmsg(), ERROR, i, MaxAllocSize, MAXDIM, ArrayType::ndim, palloc0(), PG_DETOAST_DATUM, PointerGetDatum, and SET_VARSIZE.
Referenced by array_iterate(), array_set(), array_set_slice(), build_regexp_matches_result(), construct_array(), create_singleton_array(), ExecEvalArray(), hstore_avals(), hstore_slice_to_array(), hstore_to_array_internal(), makeMdArrayResult(), percentile_cont_multi_final_common(), percentile_disc_multi_final(), plpgsql_exec_trigger(), and PLySequence_ToArray().
|
static |
Definition at line 901 of file arrayfuncs.c.
References ARR_DATA_PTR, ARR_NULLBITMAP, ArrayCastAndSet(), DatumGetPointer, elog, ERROR, i, and pfree().
Referenced by array_in(), array_map(), array_recv(), array_replace_internal(), and construct_md_array().
|
static |
Definition at line 4895 of file arrayfuncs.c.
References ARR_DIMS, ARR_LBOUND, ArrayType::dataoffset, ArrayType::elemtype, ArrayType::ndim, palloc0(), and SET_VARSIZE.
Referenced by array_fill_internal().
void deconstruct_array | ( | ArrayType * | array, |
Oid | elmtype, | ||
int | elmlen, | ||
bool | elmbyval, | ||
char | elmalign, | ||
Datum ** | elemsp, | ||
bool ** | nullsp, | ||
int * | nelemsp | ||
) |
Definition at line 3029 of file arrayfuncs.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, ARR_NULLBITMAP, ArrayGetNItems(), Assert, att_addlength_pointer, att_align_nominal, ereport, errcode(), errmsg(), ERROR, fetch_att, i, NULL, palloc(), and palloc0().
Referenced by _bt_preprocess_array_keys(), array_contain_compare(), array_set_slice(), array_to_json_internal(), arrayconst_startup_fn(), ArrayGetIntegerTypmods(), build_function_result_tupdesc_d(), compute_array_stats(), create_empty_extension(), DecodeTextArrayToCString(), decompile_column_index_array(), ExecIndexEvalArrayKeys(), extension_config_remove(), generateClonedIndexStmt(), get_attstatsslot(), get_func_arg_info(), get_func_input_arg_names(), get_func_result_name(), get_path_all(), ghstore_consistent(), gin_extract_hstore_query(), ginarrayextract(), gincost_scalararrayopexpr(), ginqueryarrayextract(), hstore_from_array(), hstore_from_arrays(), hstore_slice_to_array(), hstoreArrayToPairs(), interval_accum(), interval_avg(), json_object(), json_object_two_arg(), map_sql_value_to_xml_value(), mcelem_array_selec(), parseRelOptions(), percentile_cont_multi_final_common(), percentile_disc_multi_final(), pg_get_constraintdef_worker(), plperl_ref_from_pg_array(), scalararraysel(), text_format(), TidListCreate(), transformRelOptions(), tsa_rewrite_accum(), and untransformRelOptions().
Datum generate_subscripts | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4744 of file arrayfuncs.c.
References ARR_DIMS, ARR_LBOUND, ARR_NDIM, Int32GetDatum, generate_subscripts_fctx::lower, MAXDIM, MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, palloc(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_BOOL, PG_GETARG_INT32, PG_NARGS, generate_subscripts_fctx::reverse, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, generate_subscripts_fctx::upper, and FuncCallContext::user_fctx.
Referenced by generate_subscripts_nodir().
Datum generate_subscripts_nodir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4808 of file arrayfuncs.c.
References generate_subscripts().
Datum hash_array | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3547 of file arrayfuncs.c.
References FunctionCallInfoData::arg, FunctionCallInfoData::argnull, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, ARR_NULLBITMAP, ArrayGetNItems(), att_addlength_pointer, att_align_nominal, DatumGetUInt32, ereport, errcode(), errmsg(), ERROR, fetch_att, FmgrInfo::fn_oid, format_type_be(), FunctionCallInvoke, TypeCacheEntry::hash_proc_finfo, i, InitFunctionCallInfoData, InvalidOid, FunctionCallInfoData::isnull, lookup_type_cache(), NULL, OidIsValid, PG_FREE_IF_COPY, PG_GETARG_ARRAYTYPE_P, PG_RETURN_UINT32, TypeCacheEntry::typalign, TypeCacheEntry::typbyval, TypeCacheEntry::type_id, TYPECACHE_HASH_PROC_FINFO, and TypeCacheEntry::typlen.
Datum makeArrayResult | ( | ArrayBuildState * | astate, |
MemoryContext | rcontext | ||
) |
Definition at line 4646 of file arrayfuncs.c.
References makeMdArrayResult(), and ArrayBuildState::nelems.
Referenced by dblink_get_connections(), ExecScanSubPlan(), ExecSetParamPlan(), optionListToArray(), regexp_split_to_array(), text_to_array_internal(), transformRelOptions(), and xpath().
Datum makeMdArrayResult | ( | ArrayBuildState * | astate, |
int | ndims, | ||
int * | dims, | ||
int * | lbs, | ||
MemoryContext | rcontext, | ||
bool | release | ||
) |
Definition at line 4669 of file arrayfuncs.c.
References construct_md_array(), ArrayBuildState::dnulls, ArrayBuildState::dvalues, ArrayBuildState::element_type, ArrayBuildState::mcontext, MemoryContextDelete(), MemoryContextSwitchTo(), PointerGetDatum, ArrayBuildState::typalign, ArrayBuildState::typbyval, and ArrayBuildState::typlen.
Referenced by array_agg_finalfn(), makeArrayResult(), and plperl_array_to_datum().
|
static |
Definition at line 1388 of file arrayfuncs.c.
References AllocSizeIsValid, att_addlength_datum, att_align_nominal, StringInfoData::cursor, StringInfoData::data, ereport, errcode(), errmsg(), ERROR, i, StringInfoData::len, MaxAllocSize, StringInfoData::maxlen, NULL, PG_DETOAST_DATUM, PointerGetDatum, pq_getmsgint(), and ReceiveFunctionCall().
Referenced by array_recv().
|
static |
Definition at line 662 of file arrayfuncs.c.
References AllocSizeIsValid, array_isspace(), Array_nulls, ArrayGetOffset0(), Assert, att_addlength_datum, att_align_nominal, ereport, errcode(), errmsg(), ERROR, i, InputFunctionCall(), MaxAllocSize, MAXDIM, mda_get_prod(), MemSet, NULL, PG_DETOAST_DATUM, pg_strcasecmp(), and PointerGetDatum.
Referenced by array_in().
Definition at line 33 of file arrayfuncs.c.
Referenced by ReadArrayStr().