PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <ctype.h>
#include <math.h>
#include "catalog/pg_type.h"
#include "common/int.h"
#include "funcapi.h"
#include "libpq/pqformat.h"
#include "nodes/nodeFuncs.h"
#include "nodes/supportnodes.h"
#include "optimizer/optimizer.h"
#include "parser/scansup.h"
#include "port/pg_bitutils.h"
#include "utils/array.h"
#include "utils/arrayaccess.h"
#include "utils/builtins.h"
#include "utils/datum.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/selfuncs.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 | AARR_FREE_IF_COPY(array, n) |
#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 |
Enumerations | |
enum | ArrayToken { ATOK_LEVEL_START , ATOK_LEVEL_END , ATOK_DELIM , ATOK_ELEM , ATOK_ELEM_NULL , ATOK_ERROR } |
Functions | |
static bool | ReadArrayDimensions (char **srcptr, int *ndim_p, int *dim, int *lBound, const char *origStr, Node *escontext) |
static bool | ReadDimensionInt (char **srcptr, int *result, const char *origStr, Node *escontext) |
static bool | ReadArrayStr (char **srcptr, FmgrInfo *inputproc, Oid typioparam, int32 typmod, char typdelim, int typlen, bool typbyval, char typalign, int *ndim_p, int *dim, int *nitems_p, Datum **values_p, bool **nulls_p, const char *origStr, Node *escontext) |
static ArrayToken | ReadArrayToken (char **srcptr, StringInfo elembuf, char typdelim, const char *origStr, Node *escontext) |
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 Datum | array_get_element_expanded (Datum arraydatum, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull) |
static Datum | array_set_element_expanded (Datum arraydatum, int nSubscripts, int *indx, Datum dataValue, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign) |
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 *lbsv, 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) |
static int | width_bucket_array_float8 (Datum operand, ArrayType *thresholds) |
static int | width_bucket_array_fixed (Datum operand, ArrayType *thresholds, Oid collation, TypeCacheEntry *typentry) |
static int | width_bucket_array_variable (Datum operand, ArrayType *thresholds, Oid collation, TypeCacheEntry *typentry) |
Datum | array_in (PG_FUNCTION_ARGS) |
void | CopyArrayEls (ArrayType *array, Datum *values, bool *nulls, int nitems, int typlen, bool typbyval, char typalign, bool freedata) |
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_get_element (Datum arraydatum, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull) |
Datum | array_get_slice (Datum arraydatum, int nSubscripts, int *upperIndx, int *lowerIndx, bool *upperProvided, bool *lowerProvided, int arraytyplen, int elmlen, bool elmbyval, char elmalign) |
Datum | array_set_element (Datum arraydatum, int nSubscripts, int *indx, Datum dataValue, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign) |
Datum | array_set_slice (Datum arraydatum, int nSubscripts, int *upperIndx, int *lowerIndx, bool *upperProvided, bool *lowerProvided, Datum srcArrayDatum, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign) |
Datum | array_ref (ArrayType *array, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull) |
ArrayType * | array_set (ArrayType *array, int nSubscripts, int *indx, Datum dataValue, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign) |
Datum | array_map (Datum arrayd, ExprState *exprstate, ExprContext *econtext, Oid retType, ArrayMapState *amstate) |
ArrayType * | construct_array (Datum *elems, int nelems, Oid elmtype, int elmlen, bool elmbyval, char elmalign) |
ArrayType * | construct_array_builtin (Datum *elems, int nelems, Oid elmtype) |
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) |
ExpandedArrayHeader * | construct_empty_expanded_array (Oid element_type, MemoryContext parentcontext, ArrayMetaState *metacache) |
void | deconstruct_array (ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp) |
void | deconstruct_array_builtin (ArrayType *array, Oid elmtype, 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) |
Datum | hash_array_extended (PG_FUNCTION_ARGS) |
static bool | array_contain_compare (AnyArrayType *array1, AnyArrayType *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, ArrayMetaState *mstate) |
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 * | initArrayResult (Oid element_type, MemoryContext rcontext, bool subcontext) |
ArrayBuildState * | initArrayResultWithSize (Oid element_type, MemoryContext rcontext, bool subcontext, int initsize) |
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) |
ArrayBuildStateArr * | initArrayResultArr (Oid array_type, Oid element_type, MemoryContext rcontext, bool subcontext) |
ArrayBuildStateArr * | accumArrayResultArr (ArrayBuildStateArr *astate, Datum dvalue, bool disnull, Oid array_type, MemoryContext rcontext) |
Datum | makeArrayResultArr (ArrayBuildStateArr *astate, MemoryContext rcontext, bool release) |
ArrayBuildStateAny * | initArrayResultAny (Oid input_type, MemoryContext rcontext, bool subcontext) |
ArrayBuildStateAny * | accumArrayResultAny (ArrayBuildStateAny *astate, Datum dvalue, bool disnull, Oid input_type, MemoryContext rcontext) |
Datum | makeArrayResultAny (ArrayBuildStateAny *astate, 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_unnest_support (PG_FUNCTION_ARGS) |
Datum | array_remove (PG_FUNCTION_ARGS) |
Datum | array_replace (PG_FUNCTION_ARGS) |
Datum | width_bucket_array (PG_FUNCTION_ARGS) |
Datum | trim_array (PG_FUNCTION_ARGS) |
Variables | |
bool | Array_nulls = true |
#define AARR_FREE_IF_COPY | ( | array, | |
n | |||
) |
Definition at line 50 of file arrayfuncs.c.
#define APPENDCHAR | ( | ch | ) | (*p++ = (ch), *p = '\0') |
#define ASSGN "=" |
Definition at line 48 of file arrayfuncs.c.
typedef struct ArrayIteratorData ArrayIteratorData |
typedef struct generate_subscripts_fctx generate_subscripts_fctx |
enum ArrayToken |
Enumerator | |
---|---|
ATOK_LEVEL_START | |
ATOK_LEVEL_END | |
ATOK_DELIM | |
ATOK_ELEM | |
ATOK_ELEM_NULL | |
ATOK_ERROR |
Definition at line 57 of file arrayfuncs.c.
ArrayBuildState* accumArrayResult | ( | ArrayBuildState * | astate, |
Datum | dvalue, | ||
bool | disnull, | ||
Oid | element_type, | ||
MemoryContext | rcontext | ||
) |
Definition at line 5338 of file arrayfuncs.c.
References ArrayBuildState::alen, AllocSizeIsValid, Assert, datumCopy(), ArrayBuildState::dnulls, ArrayBuildState::dvalues, ArrayBuildState::element_type, ereport, errcode(), errmsg(), ERROR, initArrayResult(), MaxAllocSize, ArrayBuildState::mcontext, MemoryContextSwitchTo(), ArrayBuildState::nelems, PG_DETOAST_DATUM_COPY, PointerGetDatum(), repalloc(), ArrayBuildState::typbyval, and ArrayBuildState::typlen.
Referenced by accumArrayResultAny(), array_agg_transfn(), array_positions(), array_to_datum_internal(), brin_minmax_multi_summary_out(), daitch_mokotoff_coding(), dblink_get_connections(), find_or_create_child_node(), multirange_agg_transfn(), optionListToArray(), parse_ident(), pg_get_statisticsobjdef_expressions(), pg_stats_ext_mcvlist_items(), PLySequence_ToArray_recurse(), populate_array_element(), range_agg_transfn(), regexp_split_to_array(), serialize_expr_stats(), split_text_accum_result(), transformRelOptions(), and tuple_data_split_internal().
ArrayBuildStateAny* accumArrayResultAny | ( | ArrayBuildStateAny * | astate, |
Datum | dvalue, | ||
bool | disnull, | ||
Oid | input_type, | ||
MemoryContext | rcontext | ||
) |
Definition at line 5815 of file arrayfuncs.c.
References accumArrayResult(), accumArrayResultArr(), ArrayBuildStateAny::arraystate, initArrayResultAny(), and ArrayBuildStateAny::scalarstate.
Referenced by ExecScanSubPlan(), and ExecSetParamPlan().
ArrayBuildStateArr* accumArrayResultArr | ( | ArrayBuildStateArr * | astate, |
Datum | dvalue, | ||
bool | disnull, | ||
Oid | array_type, | ||
MemoryContext | rcontext | ||
) |
Definition at line 5538 of file arrayfuncs.c.
References ArrayBuildStateArr::abytes, ArrayBuildStateArr::aitems, arg, ARR_DATA_OFFSET, ARR_DATA_PTR, ARR_DIMS, ARR_HASNULL, ARR_LBOUND, ARR_NDIM, ARR_NULLBITMAP, ARR_SIZE, array_bitmap_copy(), ArrayBuildStateArr::array_type, ArrayGetNItems(), Assert, ArrayBuildStateArr::data, data, DatumGetArrayTypeP, DatumGetPointer(), ArrayBuildStateArr::dims, ereport, errcode(), errmsg(), ERROR, i, initArrayResultArr(), InvalidOid, ArrayBuildStateArr::lbs, Max, MAXDIM, ArrayBuildStateArr::mcontext, MemoryContextSwitchTo(), ArrayBuildStateArr::nbytes, ArrayBuildStateArr::ndims, ArrayBuildStateArr::nitems, nitems, ArrayBuildStateArr::nullbitmap, palloc(), pfree(), pg_nextpower2_32(), and repalloc().
Referenced by accumArrayResultAny(), and array_agg_array_transfn().
void array_bitmap_copy | ( | bits8 * | destbitmap, |
int | destoffset, | ||
const bits8 * | srcbitmap, | ||
int | srcoffset, | ||
int | nitems | ||
) |
Definition at line 4954 of file arrayfuncs.c.
References Assert, and nitems.
Referenced by accumArrayResultArr(), array_agg_array_combine(), array_cat(), array_extract_slice(), array_insert_slice(), array_set_element(), array_set_slice(), ExecEvalArrayExpr(), and makeArrayResultArr().
Datum array_cardinality | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1790 of file arrayfuncs.c.
References AARR_DIMS, AARR_NDIM, ArrayGetNItems(), PG_GETARG_ANY_ARRAY_P, and PG_RETURN_INT32.
|
static |
Definition at line 3973 of file arrayfuncs.c.
References AARR_DIMS, AARR_ELEMTYPE, AARR_FREE_IF_COPY, AARR_LBOUND, AARR_NDIM, array_iter_next(), array_iter_setup(), ArrayGetNItems(), Assert, TypeCacheEntry::cmp_proc_finfo, DatumGetInt32(), ereport, errcode(), errmsg(), ERROR, FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_extra, FmgrInfo::fn_oid, format_type_be(), FunctionCallInvoke, i, if(), InitFunctionCallInfoData, LOCAL_FCINFO, lookup_type_cache(), Min, OidIsValid, PG_GET_COLLATION, PG_GETARG_ANY_ARRAY_P, typalign, 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 4369 of file arrayfuncs.c.
References AARR_DIMS, AARR_ELEMTYPE, AARR_NDIM, array_iter_next(), array_iter_setup(), ArrayGetNItems(), DatumGetBool(), deconstruct_array(), deconstruct_expanded_array(), ExpandedArrayHeader::dnulls, ExpandedArrayHeader::dvalues, TypeCacheEntry::eq_opr_finfo, ereport, errcode(), errmsg(), ERROR, FmgrInfo::fn_oid, format_type_be(), FunctionCallInvoke, i, InitFunctionCallInfoData, j, LOCAL_FCINFO, lookup_type_cache(), ExpandedArrayHeader::nelems, OidIsValid, typalign, TypeCacheEntry::typalign, TypeCacheEntry::typbyval, TypeCacheEntry::type_id, TYPECACHE_EQ_OPR_FINFO, TypeCacheEntry::typlen, VARATT_IS_EXPANDED_HEADER, and AnyArrayType::xpn.
Referenced by arraycontained(), arraycontains(), and arrayoverlap().
Definition at line 3755 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(), array_position_common(), array_positions(), ArrayGetIntegerTypmods(), arrq_cons(), cube_a_f8(), cube_a_f8_f8(), cube_subset(), get_jsonb_path_all(), get_path_all(), getWeights(), lt_q_regex(), pg_isolation_test_session_is_blocked(), pg_logical_slot_get_changes_guts(), sanity_check_array(), sanity_check_tid_array(), width_bucket_array(), and worker_spi_launch().
|
static |
Definition at line 4924 of file arrayfuncs.c.
References array_nelems_size(), nitems, and typalign.
Referenced by array_extract_slice(), and array_insert_slice().
ArrayIterator array_create_iterator | ( | ArrayType * | arr, |
int | slice_ndim, | ||
ArrayMetaState * | mstate | ||
) |
Definition at line 4585 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, ArrayMetaState::element_type, 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, ArrayMetaState::typalign, ArrayIteratorData::typbyval, ArrayMetaState::typbyval, ArrayIteratorData::typlen, and ArrayMetaState::typlen.
Referenced by array_position_common(), array_positions(), and exec_stmt_foreach_a().
Datum array_dims | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1668 of file arrayfuncs.c.
References AARR_DIMS, AARR_LBOUND, AARR_NDIM, buf, cstring_to_text(), i, MAXDIM, PG_GETARG_ANY_ARRAY_P, PG_RETURN_NULL, PG_RETURN_TEXT_P, and sprintf.
Datum array_eq | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3802 of file arrayfuncs.c.
References AARR_DIMS, AARR_ELEMTYPE, AARR_FREE_IF_COPY, AARR_LBOUND, AARR_NDIM, array_iter_next(), array_iter_setup(), ArrayGetNItems(), DatumGetBool(), TypeCacheEntry::eq_opr_finfo, ereport, errcode(), errmsg(), ERROR, FmgrInfo::fn_oid, format_type_be(), FunctionCallInvoke, i, if(), InitFunctionCallInfoData, LOCAL_FCINFO, lookup_type_cache(), nitems, OidIsValid, PG_GET_COLLATION, PG_GETARG_ANY_ARRAY_P, PG_RETURN_BOOL, typalign, TypeCacheEntry::typalign, TypeCacheEntry::typbyval, TypeCacheEntry::type_id, TYPECACHE_EQ_OPR_FINFO, and TypeCacheEntry::typlen.
Referenced by array_ne(), and CompareOpclassOptions().
|
static |
Definition at line 5085 of file arrayfuncs.c.
References ARR_DATA_PTR, ARR_NULLBITMAP, array_bitmap_copy(), array_copy(), array_seek(), ArrayGetOffset(), i, j, MAXDIM, mda_get_offset_values(), mda_get_prod(), mda_get_range(), mda_next_tuple(), and typalign.
Referenced by array_get_slice().
Datum array_fill | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6019 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.
|
static |
Definition at line 6071 of file arrayfuncs.c.
References AllocSizeIsValid, ARR_DATA_PTR, ARR_DIMS, ARR_NDIM, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, array_contains_nulls(), ArrayCastAndSet(), ArrayCheckBounds(), ArrayGetNItems(), Assert, att_addlength_datum, att_align_nominal, construct_empty_array(), create_array_envelope(), ArrayMetaState::element_type, ereport, errcode(), errdetail(), errmsg(), ERROR, FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_extra, FmgrInfo::fn_mcxt, get_typlenbyvalalign(), i, if(), InvalidOid, MaxAllocSize, MAXDIM, MemoryContextAlloc(), nitems, PG_DETOAST_DATUM, PointerGetDatum(), ArrayMetaState::typalign, ArrayMetaState::typbyval, ArrayMetaState::typlen, and value.
Referenced by array_fill(), and array_fill_with_lower_bounds().
Datum array_fill_with_lower_bounds | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5978 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 4747 of file arrayfuncs.c.
References pfree(), ArrayIteratorData::slice_ndim, ArrayIteratorData::slice_nulls, and ArrayIteratorData::slice_values.
Referenced by array_position_common(), and array_positions().
Datum array_ge | ( | PG_FUNCTION_ARGS | ) |
Datum array_get_element | ( | Datum | arraydatum, |
int | nSubscripts, | ||
int * | indx, | ||
int | arraytyplen, | ||
int | elmlen, | ||
bool | elmbyval, | ||
char | elmalign, | ||
bool * | isNull | ||
) |
Definition at line 1820 of file arrayfuncs.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_LBOUND, ARR_NDIM, ARR_NULLBITMAP, array_get_element_expanded(), array_get_isnull(), array_seek(), ArrayCast(), ArrayGetOffset(), DatumGetArrayTypeP, DatumGetPointer(), i, MAXDIM, and VARATT_IS_EXTERNAL_EXPANDED.
Referenced by array_ref(), array_subscript_fetch(), array_subscript_fetch_old(), ATExecAlterColumnType(), and RelationBuildTupleDesc().
|
static |
Definition at line 1921 of file arrayfuncs.c.
References ArrayGetOffset(), Assert, DatumGetEOHP(), deconstruct_expanded_array(), ExpandedArrayHeader::dims, ExpandedArrayHeader::dnulls, ExpandedArrayHeader::dvalues, EA_MAGIC, ExpandedArrayHeader::ea_magic, i, ExpandedArrayHeader::lbound, MAXDIM, ExpandedArrayHeader::ndims, ExpandedArrayHeader::typalign, ExpandedArrayHeader::typbyval, and ExpandedArrayHeader::typlen.
Referenced by array_get_element().
Definition at line 4769 of file arrayfuncs.c.
Referenced by array_get_element(), array_iterate(), array_set_element(), and array_slice_size().
Datum array_get_slice | ( | Datum | arraydatum, |
int | nSubscripts, | ||
int * | upperIndx, | ||
int * | lowerIndx, | ||
bool * | upperProvided, | ||
bool * | lowerProvided, | ||
int | arraytyplen, | ||
int | elmlen, | ||
bool | elmbyval, | ||
char | elmalign | ||
) |
Definition at line 2030 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, DatumGetPointer(), ArrayType::elemtype, ereport, errcode(), errmsg(), ERROR, i, InvalidOid, MAXDIM, mda_get_range(), ArrayType::ndim, palloc0(), PointerGetDatum(), and SET_VARSIZE.
Referenced by array_subscript_fetch_old_slice(), array_subscript_fetch_slice(), and trim_array().
Datum array_gt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3943 of file arrayfuncs.c.
References array_cmp(), and PG_RETURN_BOOL.
Datum array_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 179 of file arrayfuncs.c.
References AllocSizeIsValid, ARR_DIMS, ARR_LBOUND, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, ASSGN, att_addlength_datum, att_align_nominal, construct_empty_array(), CopyArrayEls(), ArrayType::dataoffset, ArrayMetaState::element_type, ArrayType::elemtype, ereturn, errcode(), errdetail(), errmsg(), fmgr_info_cxt(), FmgrInfo::fn_mcxt, get_type_io_data(), i, if(), IOFunc_input, MaxAllocSize, MAXDIM, MemoryContextAlloc(), ArrayType::ndim, nitems, palloc0(), pfree(), PG_DETOAST_DATUM, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_ARRAYTYPE_P, PointerGetDatum(), ArrayMetaState::proc, ReadArrayDimensions(), ReadArrayStr(), scanner_isspace(), SET_VARSIZE, typalign, ArrayMetaState::typalign, ArrayMetaState::typbyval, ArrayMetaState::typdelim, ArrayMetaState::typiofunc, ArrayMetaState::typioparam, ArrayMetaState::typlen, and values.
Referenced by extract_variadic_args().
|
static |
Definition at line 5158 of file arrayfuncs.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_NDIM, ARR_NULLBITMAP, array_bitmap_copy(), array_copy(), array_seek(), ArrayGetNItems(), ArrayGetOffset(), i, j, MAXDIM, mda_get_offset_values(), mda_get_prod(), mda_get_range(), mda_next_tuple(), and typalign.
Referenced by array_set_slice().
bool array_iterate | ( | ArrayIterator | iterator, |
Datum * | value, | ||
bool * | isnull | ||
) |
Definition at line 4664 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, value, and values.
Referenced by array_position_common(), array_positions(), and exec_stmt_foreach_a().
Datum array_larger | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5873 of file arrayfuncs.c.
References array_cmp(), PG_GETARG_DATUM, and PG_RETURN_DATUM.
Datum array_le | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3949 of file arrayfuncs.c.
References array_cmp(), and PG_RETURN_BOOL.
Datum array_length | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1763 of file arrayfuncs.c.
References AARR_DIMS, AARR_NDIM, MAXDIM, PG_GETARG_ANY_ARRAY_P, PG_GETARG_INT32, PG_RETURN_INT32, and PG_RETURN_NULL.
Referenced by trim_array().
Datum array_lower | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1706 of file arrayfuncs.c.
References AARR_LBOUND, AARR_NDIM, MAXDIM, PG_GETARG_ANY_ARRAY_P, PG_GETARG_INT32, PG_RETURN_INT32, and PG_RETURN_NULL.
Datum array_lt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3937 of file arrayfuncs.c.
References array_cmp(), and PG_RETURN_BOOL.
Datum array_map | ( | Datum | arrayd, |
ExprState * | exprstate, | ||
ExprContext * | econtext, | ||
Oid | retType, | ||
ArrayMapState * | amstate | ||
) |
Definition at line 3201 of file arrayfuncs.c.
References AARR_DIMS, AARR_ELEMTYPE, AARR_LBOUND, AARR_NDIM, AllocSizeIsValid, ARR_DIMS, ARR_LBOUND, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, array_iter_next(), array_iter_setup(), ArrayGetNItems(), att_addlength_datum, att_align_nominal, construct_empty_array(), CopyArrayEls(), ArrayType::dataoffset, DatumGetAnyArrayP(), ArrayMetaState::element_type, ArrayType::elemtype, ereport, errcode(), errmsg(), ERROR, ExecEvalExpr(), get_typlenbyvalalign(), i, ExprState::innermost_casenull, ExprState::innermost_caseval, ArrayMapState::inp_extra, MaxAllocSize, ArrayType::ndim, nitems, palloc(), palloc0(), pfree(), PG_DETOAST_DATUM, PointerGetDatum(), ArrayMapState::ret_extra, SET_VARSIZE, typalign, ArrayMetaState::typalign, ArrayMetaState::typbyval, ArrayMetaState::typlen, and values.
Referenced by ExecEvalArrayCoerce().
Datum array_ndims | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1652 of file arrayfuncs.c.
References AARR_NDIM, MAXDIM, PG_GETARG_ANY_ARRAY_P, PG_RETURN_INT32, and PG_RETURN_NULL.
Datum array_ne | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3931 of file arrayfuncs.c.
References array_eq(), DatumGetBool(), and PG_RETURN_BOOL.
|
static |
Definition at line 4902 of file arrayfuncs.c.
References array_seek(), nitems, and typalign.
Referenced by array_copy(), and array_set_slice().
Datum array_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1016 of file arrayfuncs.c.
References AARR_DIMS, AARR_ELEMTYPE, AARR_LBOUND, AARR_NDIM, APPENDCHAR, APPENDSTR, array_iter_next(), array_iter_setup(), ArrayGetNItems(), Assert, ASSGN, ArrayMetaState::element_type, fmgr_info_cxt(), FmgrInfo::fn_mcxt, get_type_io_data(), i, if(), IOFunc_output, j, MAXDIM, MemoryContextAlloc(), nitems, OutputFunctionCall(), palloc(), pfree(), PG_GETARG_ANY_ARRAY_P, PG_RETURN_CSTRING, pg_strcasecmp(), ArrayMetaState::proc, pstrdup(), scanner_isspace(), sprintf, typalign, ArrayMetaState::typalign, ArrayMetaState::typbyval, ArrayMetaState::typdelim, ArrayMetaState::typiofunc, ArrayMetaState::typioparam, ArrayMetaState::typlen, and values.
Referenced by anyarray_out(), and anycompatiblearray_out().
Datum array_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1271 of file arrayfuncs.c.
References ARR_DIMS, ARR_LBOUND, ARR_OVERHEAD_NONULLS, ARR_OVERHEAD_WITHNULLS, ArrayCheckBounds(), ArrayGetNItems(), buf, construct_empty_array(), CopyArrayEls(), ArrayType::dataoffset, ArrayMetaState::element_type, ArrayType::elemtype, ereport, errcode(), errmsg(), ERROR, FirstGenbkiObjectId, fmgr_info_cxt(), FmgrInfo::fn_mcxt, FORMAT_TYPE_ALLOW_INVALID, format_type_be(), format_type_extended(), get_type_io_data(), i, if(), IOFunc_receive, MAXDIM, MemoryContextAlloc(), ArrayType::ndim, nitems, OidIsValid, palloc(), palloc0(), pfree(), PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_ARRAYTYPE_P, pq_getmsgint(), ArrayMetaState::proc, ReadArrayBinary(), SET_VARSIZE, typalign, 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 3146 of file arrayfuncs.c.
References array_get_element(), and PointerGetDatum().
Referenced by GUCArrayAdd(), GUCArrayDelete(), GUCArrayReset(), pg_get_functiondef(), and TransformGUCArray().
Datum array_remove | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6625 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 6647 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 6367 of file arrayfuncs.c.
References AllocSizeIsValid, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_LBOUND, 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(), FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_extra, FmgrInfo::fn_oid, format_type_be(), FunctionCallInvoke, i, if(), InitFunctionCallInfoData, LOCAL_FCINFO, lookup_type_cache(), MaxAllocSize, ArrayType::ndim, nitems, OidIsValid, palloc(), palloc0(), pfree(), PG_DETOAST_DATUM, PointerGetDatum(), SET_VARSIZE, skip, typalign, 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 4854 of file arrayfuncs.c.
References att_addlength_pointer, att_align_nominal, i, nitems, and typalign.
Referenced by array_extract_slice(), array_get_element(), array_insert_slice(), array_nelems_size(), array_set_element(), and array_slice_size().
Datum array_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1548 of file arrayfuncs.c.
References AARR_DIMS, AARR_ELEMTYPE, AARR_HASNULL, AARR_LBOUND, AARR_NDIM, array_iter_next(), array_iter_setup(), ArrayGetNItems(), buf, ArrayMetaState::element_type, ereport, errcode(), errmsg(), ERROR, fmgr_info_cxt(), FmgrInfo::fn_mcxt, format_type_be(), get_type_io_data(), i, if(), IOFunc_send, MemoryContextAlloc(), nitems, OidIsValid, pfree(), PG_GETARG_ANY_ARRAY_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendbytes(), pq_sendint32(), ArrayMetaState::proc, SendFunctionCall(), typalign, ArrayMetaState::typalign, ArrayMetaState::typbyval, ArrayMetaState::typdelim, ArrayMetaState::typiofunc, ArrayMetaState::typioparam, ArrayMetaState::typlen, VARDATA, VARHDRSZ, and VARSIZE.
Referenced by anyarray_send(), anycompatiblearray_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 3163 of file arrayfuncs.c.
References array_set_element(), DatumGetArrayTypeP, and PointerGetDatum().
Referenced by GUCArrayAdd(), GUCArrayDelete(), GUCArrayReset(), and pg_extension_config_dump().
Datum array_set_element | ( | Datum | arraydatum, |
int | nSubscripts, | ||
int * | indx, | ||
Datum | dataValue, | ||
bool | isNull, | ||
int | arraytyplen, | ||
int | elmlen, | ||
bool | elmbyval, | ||
char | elmalign | ||
) |
Definition at line 2201 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_element_expanded(), array_set_isnull(), ArrayCastAndSet(), ArrayCheckBounds(), ArrayGetNItems(), ArrayGetOffset(), att_addlength_datum, att_addlength_pointer, att_align_nominal, construct_md_array(), ArrayType::dataoffset, DatumGetArrayTypeP, DatumGetPointer(), ArrayType::elemtype, ereport, errcode(), errmsg(), ERROR, i, MaxArraySize, MAXDIM, ArrayType::ndim, palloc(), palloc0(), pg_add_s32_overflow(), PG_DETOAST_DATUM, pg_sub_s32_overflow(), PointerGetDatum(), SET_VARSIZE, and VARATT_IS_EXTERNAL_EXPANDED.
Referenced by array_append(), array_prepend(), array_set(), and array_subscript_assign().
|
static |
Definition at line 2501 of file arrayfuncs.c.
References ArrayCheckBounds(), ArrayGetNItems(), ArrayGetOffset(), Assert, datumCopy(), DatumGetExpandedArray(), DatumGetPointer(), deconstruct_expanded_array(), ExpandedArrayHeader::dims, ExpandedArrayHeader::dnulls, ExpandedArrayHeader::dvalues, ExpandedArrayHeader::dvalueslen, ExpandedObjectHeader::eoh_context, EOHPGetRWDatum(), ereport, errcode(), errmsg(), ERROR, ExpandedArrayHeader::fendptr, ExpandedArrayHeader::flat_size, ExpandedArrayHeader::fvalue, ExpandedArrayHeader::hdr, i, ExpandedArrayHeader::lbound, Max, MaxArraySize, MAXDIM, MemoryContextAllocZero(), MemoryContextSwitchTo(), ExpandedArrayHeader::ndims, ExpandedArrayHeader::nelems, pfree(), pg_add_s32_overflow(), pg_sub_s32_overflow(), repalloc(), ExpandedArrayHeader::typalign, ExpandedArrayHeader::typbyval, and ExpandedArrayHeader::typlen.
Referenced by array_set_element().
Datum array_set_slice | ( | Datum | arraydatum, |
int | nSubscripts, | ||
int * | upperIndx, | ||
int * | lowerIndx, | ||
bool * | upperProvided, | ||
bool * | lowerProvided, | ||
Datum | srcArrayDatum, | ||
bool | isNull, | ||
int | arraytyplen, | ||
int | elmlen, | ||
bool | elmbyval, | ||
char | elmalign | ||
) |
Definition at line 2806 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(), ArrayCheckBounds(), ArrayGetNItems(), Assert, construct_md_array(), ArrayType::dataoffset, DatumGetArrayTypeP, deconstruct_array(), ArrayType::elemtype, ereport, errcode(), errdetail(), errmsg(), ERROR, i, Max, MaxArraySize, MAXDIM, mda_get_range(), Min, ArrayType::ndim, nitems, palloc0(), pg_add_s32_overflow(), pg_sub_s32_overflow(), PointerGetDatum(), and SET_VARSIZE.
Referenced by array_subscript_assign_slice().
|
static |
Definition at line 5025 of file arrayfuncs.c.
References array_get_isnull(), array_seek(), ArrayGetNItems(), ArrayGetOffset(), att_addlength_pointer, att_align_nominal, i, j, MAXDIM, mda_get_offset_values(), mda_get_prod(), mda_get_range(), mda_next_tuple(), and typalign.
Referenced by array_get_slice(), and array_set_slice().
Datum array_smaller | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5882 of file arrayfuncs.c.
References array_cmp(), PG_GETARG_DATUM, and PG_RETURN_DATUM.
Datum array_unnest | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6240 of file arrayfuncs.c.
References AARR_DIMS, AARR_ELEMTYPE, AARR_NDIM, array_iter_next(), array_iter_setup(), ArrayGetNItems(), get_typlenbyvalalign(), MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, palloc(), PG_GETARG_ANY_ARRAY_P, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, ExpandedArrayHeader::typalign, ExpandedArrayHeader::typbyval, ExpandedArrayHeader::typlen, FuncCallContext::user_fctx, VARATT_IS_EXPANDED_HEADER, and AnyArrayType::xpn.
Datum array_unnest_support | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6331 of file arrayfuncs.c.
References generate_unaccent_rules::args, estimate_array_length(), estimate_expression_value(), is_funcclause(), IsA, linitial, SupportRequestRows::node, PG_GETARG_POINTER, PG_RETURN_POINTER, SupportRequestRows::root, and SupportRequestRows::rows.
Datum array_upper | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1733 of file arrayfuncs.c.
References AARR_DIMS, AARR_LBOUND, AARR_NDIM, MAXDIM, PG_GETARG_ANY_ARRAY_P, PG_GETARG_INT32, PG_RETURN_INT32, and PG_RETURN_NULL.
Definition at line 4804 of file arrayfuncs.c.
References fetch_att(), len, and value.
Referenced by array_get_element().
|
static |
Definition at line 4815 of file arrayfuncs.c.
References Assert, att_addlength_datum, att_align_nominal, DatumGetPointer(), generate_unaccent_rules::dest, store_att_byval(), and typalign.
Referenced by array_fill_internal(), array_set_element(), and CopyArrayEls().
Datum arraycontained | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4548 of file arrayfuncs.c.