PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "catalog/pg_type.h"
#include "common/int.h"
#include "common/pg_prng.h"
#include "libpq/pqformat.h"
#include "port/pg_bitutils.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/datum.h"
#include "utils/lsyscache.h"
#include "utils/typcache.h"
Go to the source code of this file.
Data Structures | |
struct | SerialIOData |
struct | DeserialIOData |
Typedefs | |
typedef struct SerialIOData | SerialIOData |
typedef struct DeserialIOData | DeserialIOData |
typedef struct DeserialIOData DeserialIOData |
typedef struct SerialIOData SerialIOData |
Datum array_agg_array_combine | ( | PG_FUNCTION_ARGS | ) |
Definition at line 901 of file array_userfuncs.c.
References ArrayBuildStateArr::abytes, AggCheckCallContext(), ArrayBuildStateArr::aitems, array_bitmap_copy(), ArrayBuildStateArr::array_type, Assert, ArrayBuildStateArr::data, ArrayBuildStateArr::dims, ArrayBuildStateArr::element_type, elog, ereport, errcode(), errmsg(), ERROR, i, initArrayResultArr(), InvalidOid, ArrayBuildStateArr::lbs, Max, ArrayBuildStateArr::mcontext, MemoryContextSwitchTo(), ArrayBuildStateArr::nbytes, ArrayBuildStateArr::ndims, ArrayBuildStateArr::nitems, ArrayBuildStateArr::nullbitmap, palloc(), PG_ARGISNULL, PG_GETARG_POINTER, pg_nextpower2_32(), PG_RETURN_NULL, PG_RETURN_POINTER, repalloc(), and size.
Datum array_agg_array_deserialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1109 of file array_userfuncs.c.
References ArrayBuildStateArr::abytes, AggCheckCallContext(), ArrayBuildStateArr::aitems, Assert, buf, CurrentMemoryContext, ArrayBuildStateArr::data, ArrayBuildStateArr::dims, initArrayResultArr(), initReadOnlyStringInfo(), ArrayBuildStateArr::lbs, ArrayBuildStateArr::nbytes, ArrayBuildStateArr::ndims, ArrayBuildStateArr::nitems, ArrayBuildStateArr::nullbitmap, palloc(), PG_GETARG_BYTEA_PP, PG_RETURN_POINTER, pq_getmsgbytes(), pq_getmsgend(), pq_getmsgint(), size, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum array_agg_array_finalfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1192 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, CurrentMemoryContext, makeArrayResultArr(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_DATUM, and PG_RETURN_NULL.
Datum array_agg_array_serialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1050 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, buf, PG_GETARG_POINTER, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendbytes(), and pq_sendint32().
Datum array_agg_array_transfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 857 of file array_userfuncs.c.
References accumArrayResultArr(), AggCheckCallContext(), elog, ereport, errcode(), errmsg(), ERROR, get_fn_expr_argtype(), initArrayResultArr(), InvalidOid, PG_ARGISNULL, PG_GETARG_DATUM, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum array_agg_combine | ( | PG_FUNCTION_ARGS | ) |
Definition at line 525 of file array_userfuncs.c.
References AggCheckCallContext(), ArrayBuildState::alen, Assert, datumCopy(), ArrayBuildState::dnulls, ArrayBuildState::dvalues, ArrayBuildState::element_type, elog, ERROR, i, initArrayResultWithSize(), ArrayBuildState::mcontext, MemoryContextSwitchTo(), ArrayBuildState::nelems, PG_ARGISNULL, PG_GETARG_POINTER, pg_nextpower2_32(), PG_RETURN_NULL, PG_RETURN_POINTER, repalloc(), ArrayBuildState::typbyval, and ArrayBuildState::typlen.
Datum array_agg_deserialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 711 of file array_userfuncs.c.
References AggCheckCallContext(), buf, CurrentMemoryContext, ArrayBuildState::dnulls, ArrayBuildState::dvalues, elog, ereport, errcode(), errmsg(), ERROR, fmgr_info_cxt(), FmgrInfo::fn_mcxt, getTypeBinaryInputInfo(), i, if(), initArrayResultWithSize(), initReadOnlyStringInfo(), MemoryContextAlloc(), ArrayBuildState::nelems, PG_GETARG_BYTEA_PP, PG_RETURN_POINTER, pq_getmsgbyte(), pq_getmsgbytes(), pq_getmsgend(), pq_getmsgint(), pq_getmsgint64(), ReceiveFunctionCall(), ArrayBuildState::typalign, ArrayBuildState::typbyval, DeserialIOData::typioparam, ArrayBuildState::typlen, DeserialIOData::typreceive, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum array_agg_finalfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 822 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, CurrentMemoryContext, makeMdArrayResult(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_DATUM, and PG_RETURN_NULL.
Datum array_agg_serialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 622 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, buf, fmgr_info_cxt(), FmgrInfo::fn_mcxt, getTypeBinaryOutputInfo(), i, if(), MemoryContextAlloc(), PG_GETARG_POINTER, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendbyte(), pq_sendbytes(), pq_sendint16(), pq_sendint32(), pq_sendint64(), SendFunctionCall(), SerialIOData::typsend, VARDATA, VARHDRSZ, and VARSIZE.
Datum array_agg_transfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 479 of file array_userfuncs.c.
References accumArrayResult(), AggCheckCallContext(), elog, ereport, errcode(), errmsg(), ERROR, get_fn_expr_argtype(), initArrayResult(), InvalidOid, PG_ARGISNULL, PG_GETARG_DATUM, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum array_append | ( | PG_FUNCTION_ARGS | ) |
Definition at line 123 of file array_userfuncs.c.
References array_set_element(), ExpandedArrayHeader::dims, EOHPGetRWDatum(), ereport, errcode(), errmsg(), ERROR, fetch_array_arg_replace_nulls(), ExpandedArrayHeader::hdr, ExpandedArrayHeader::lbound, ExpandedArrayHeader::ndims, pg_add_s32_overflow(), PG_ARGISNULL, PG_GETARG_DATUM, PG_RETURN_DATUM, ArrayMetaState::typalign, ArrayMetaState::typbyval, and ArrayMetaState::typlen.
Datum array_cat | ( | PG_FUNCTION_ARGS | ) |
Definition at line 240 of file array_userfuncs.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(), ArrayCheckBounds(), ArrayGetNItems(), ArrayType::dataoffset, ArrayType::elemtype, ereport, errcode(), errdetail(), errmsg(), ERROR, format_type_be(), i, ArrayType::ndim, nitems, palloc(), palloc0(), PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_RETURN_ARRAYTYPE_P, PG_RETURN_NULL, and SET_VARSIZE.
Datum array_position | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1225 of file array_userfuncs.c.
References array_position_common().
|
static |
Definition at line 1244 of file array_userfuncs.c.
References ARR_ELEMTYPE, ARR_LBOUND, ARR_NDIM, array_contains_nulls(), array_create_iterator(), array_free_iterator(), array_iterate(), array_iterator(), DatumGetBool(), ArrayMetaState::element_type, TypeCacheEntry::eq_opr_finfo, ereport, errcode(), errmsg(), ERROR, FunctionCallInfoBaseData::flinfo, fmgr_info_cxt(), FmgrInfo::fn_extra, FmgrInfo::fn_mcxt, FmgrInfo::fn_oid, format_type_be(), FunctionCall2Coll(), get_typlenbyvalalign(), if(), lookup_type_cache(), MemoryContextAlloc(), OidIsValid, PG_ARGISNULL, PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_ARRAYTYPE_P, PG_GETARG_DATUM, PG_GETARG_INT32, PG_NARGS, PG_RETURN_INT32, PG_RETURN_NULL, ArrayMetaState::proc, ArrayMetaState::typalign, ArrayMetaState::typbyval, TYPECACHE_EQ_OPR_FINFO, ArrayMetaState::typlen, and value.
Referenced by array_position(), and array_position_start().
Datum array_position_start | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1231 of file array_userfuncs.c.
References array_position_common().
Datum array_positions | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1399 of file array_userfuncs.c.
References accumArrayResult(), ARR_ELEMTYPE, ARR_LBOUND, ARR_NDIM, array_contains_nulls(), array_create_iterator(), array_free_iterator(), array_iterate(), array_iterator(), CurrentMemoryContext, DatumGetBool(), ArrayMetaState::element_type, TypeCacheEntry::eq_opr_finfo, ereport, errcode(), errmsg(), ERROR, fmgr_info_cxt(), FmgrInfo::fn_mcxt, FmgrInfo::fn_oid, format_type_be(), FunctionCall2Coll(), get_typlenbyvalalign(), if(), initArrayResult(), Int32GetDatum(), lookup_type_cache(), makeArrayResult(), MemoryContextAlloc(), OidIsValid, PG_ARGISNULL, PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_ARRAYTYPE_P, PG_GETARG_DATUM, PG_RETURN_DATUM, PG_RETURN_NULL, ArrayMetaState::proc, ArrayMetaState::typalign, ArrayMetaState::typbyval, TYPECACHE_EQ_OPR_FINFO, ArrayMetaState::typlen, and value.
Datum array_prepend | ( | PG_FUNCTION_ARGS | ) |
Definition at line 176 of file array_userfuncs.c.
References array_set_element(), Assert, EOHPGetRWDatum(), ereport, errcode(), errmsg(), ERROR, fetch_array_arg_replace_nulls(), ExpandedArrayHeader::hdr, ExpandedArrayHeader::lbound, ExpandedArrayHeader::ndims, PG_ARGISNULL, PG_GETARG_DATUM, PG_RETURN_DATUM, pg_sub_s32_overflow(), ArrayMetaState::typalign, ArrayMetaState::typbyval, and ArrayMetaState::typlen.
Datum array_reverse | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1774 of file array_userfuncs.c.
References ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, array_reverse_n(), if(), lookup_type_cache(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_ARRAYTYPE_P, and TypeCacheEntry::type_id.
|
static |
Definition at line 1699 of file array_userfuncs.c.
References ARR_DIMS, ARR_LBOUND, ARR_NDIM, construct_md_array(), deconstruct_array(), i, j, MAXDIM, pfree(), TypeCacheEntry::typalign, TypeCacheEntry::typbyval, and TypeCacheEntry::typlen.
Referenced by array_reverse().
Datum array_sample | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1660 of file array_userfuncs.c.
References ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, array_shuffle_n(), ereport, errcode(), errmsg(), ERROR, if(), lookup_type_cache(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_RETURN_ARRAYTYPE_P, and TypeCacheEntry::type_id.
Datum array_shuffle | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1626 of file array_userfuncs.c.
References ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, array_shuffle_n(), if(), lookup_type_cache(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_ARRAYTYPE_P, and TypeCacheEntry::type_id.
|
static |
Definition at line 1537 of file array_userfuncs.c.
References ARR_DIMS, ARR_LBOUND, ARR_NDIM, Assert, construct_empty_array(), construct_md_array(), deconstruct_array(), i, j, MAXDIM, pfree(), pg_global_prng_state, pg_prng_uint64_range(), TypeCacheEntry::typalign, TypeCacheEntry::typbyval, and TypeCacheEntry::typlen.
Referenced by array_sample(), and array_shuffle().
|
static |
Definition at line 64 of file array_userfuncs.c.
References AggCheckCallContext(), construct_empty_expanded_array(), CurrentMemoryContext, ArrayMetaState::element_type, ereport, errcode(), errmsg(), ERROR, FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_extra, FmgrInfo::fn_mcxt, get_element_type(), get_fn_expr_argtype(), if(), InvalidOid, MemoryContextAlloc(), MemoryContextSwitchTo(), OidIsValid, PG_ARGISNULL, and PG_GETARG_EXPANDED_ARRAYX.
Referenced by array_append(), and array_prepend().