|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "catalog/pg_operator_d.h"#include "catalog/pg_type.h"#include "common/int.h"#include "common/pg_prng.h"#include "libpq/pqformat.h"#include "miscadmin.h"#include "nodes/supportnodes.h"#include "port/pg_bitutils.h"#include "utils/array.h"#include "utils/builtins.h"#include "utils/datum.h"#include "utils/lsyscache.h"#include "utils/tuplesort.h"#include "utils/typcache.h"
Go to the source code of this file.
Data Structures | |
| struct | SerialIOData |
| struct | DeserialIOData |
| struct | ArraySortCachedInfo |
Typedefs | |
| typedef struct SerialIOData | SerialIOData |
| typedef struct DeserialIOData | DeserialIOData |
| typedef struct ArraySortCachedInfo | ArraySortCachedInfo |
| Datum array_agg_array_combine | ( | PG_FUNCTION_ARGS | ) |
Definition at line 977 of file array_userfuncs.c.
References AggCheckCallContext(), array_bitmap_copy(), Assert, elog, ereport, errcode(), errmsg(), ERROR, fb(), i, initArrayResultArr(), InvalidOid, Max, MemoryContextSwitchTo(), palloc(), PG_ARGISNULL, PG_GETARG_POINTER, pg_nextpower2_32(), PG_RETURN_NULL, PG_RETURN_POINTER, and repalloc().
| Datum array_agg_array_deserialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1185 of file array_userfuncs.c.
References ArrayBuildStateArr::abytes, AggCheckCallContext(), ArrayBuildStateArr::aitems, Assert, buf, CurrentMemoryContext, ArrayBuildStateArr::data, ArrayBuildStateArr::dims, fb(), 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(), VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
| Datum array_agg_array_finalfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1268 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, CurrentMemoryContext, fb(), makeArrayResultArr(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_DATUM, and PG_RETURN_NULL.
| Datum array_agg_array_serialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1126 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, buf, fb(), 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 933 of file array_userfuncs.c.
References accumArrayResultArr(), AggCheckCallContext(), elog, ereport, errcode(), errmsg(), ERROR, fb(), 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 601 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, datumCopy(), elog, ERROR, fb(), i, initArrayResultWithSize(), MemoryContextSwitchTo(), PG_ARGISNULL, PG_GETARG_POINTER, pg_nextpower2_32(), PG_RETURN_NULL, PG_RETURN_POINTER, and repalloc().
| Datum array_agg_deserialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 787 of file array_userfuncs.c.
References AggCheckCallContext(), buf, CurrentMemoryContext, ArrayBuildState::dnulls, ArrayBuildState::dvalues, elog, ereport, errcode(), errmsg(), ERROR, fb(), fmgr_info_cxt(), getTypeBinaryInputInfo(), i, 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, ArrayBuildState::typlen, VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
| Datum array_agg_finalfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 898 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, CurrentMemoryContext, fb(), makeMdArrayResult(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_DATUM, and PG_RETURN_NULL.
| Datum array_agg_serialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 698 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, buf, fb(), fmgr_info_cxt(), getTypeBinaryOutputInfo(), i, MemoryContextAlloc(), PG_GETARG_POINTER, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendbyte(), pq_sendbytes(), pq_sendint16(), pq_sendint32(), pq_sendint64(), SendFunctionCall(), VARDATA(), VARHDRSZ, and VARSIZE().
| Datum array_agg_transfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 555 of file array_userfuncs.c.
References accumArrayResult(), AggCheckCallContext(), elog, ereport, errcode(), errmsg(), ERROR, fb(), 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 139 of file array_userfuncs.c.
References array_set_element(), EOHPGetRWDatum(), ereport, errcode(), errmsg(), ERROR, fb(), fetch_array_arg_replace_nulls(), pg_add_s32_overflow(), PG_ARGISNULL, PG_GETARG_DATUM, and PG_RETURN_DATUM.
| Datum array_append_support | ( | PG_FUNCTION_ARGS | ) |
Definition at line 192 of file array_userfuncs.c.
References arg, fb(), IsA, linitial, PARAM_EXTERN, PG_GETARG_POINTER, and PG_RETURN_POINTER.
| Datum array_cat | ( | PG_FUNCTION_ARGS | ) |
Definition at line 316 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, fb(), format_type_be(), i, ArrayType::ndim, nitems, palloc0(), palloc_array, 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 1301 of file array_userfuncs.c.
References array_position_common().
|
static |
Definition at line 1320 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(), TypeCacheEntry::eq_opr_finfo, ereport, errcode(), errmsg(), ERROR, fb(), FunctionCallInfoBaseData::flinfo, fmgr_info_cxt(), FmgrInfo::fn_extra, FmgrInfo::fn_mcxt, FmgrInfo::fn_oid, format_type_be(), FunctionCall2Coll(), get_typlenbyvalalign(), 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, TYPECACHE_EQ_OPR_FINFO, and value.
Referenced by array_position(), and array_position_start().
| Datum array_position_start | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1307 of file array_userfuncs.c.
References array_position_common().
| Datum array_positions | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1475 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(), TypeCacheEntry::eq_opr_finfo, ereport, errcode(), errmsg(), ERROR, fb(), fmgr_info_cxt(), FmgrInfo::fn_oid, format_type_be(), FunctionCall2Coll(), get_typlenbyvalalign(), 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, TYPECACHE_EQ_OPR_FINFO, and value.
| Datum array_prepend | ( | PG_FUNCTION_ARGS | ) |
Definition at line 222 of file array_userfuncs.c.
References array_set_element(), Assert, EOHPGetRWDatum(), ereport, errcode(), errmsg(), ERROR, fb(), fetch_array_arg_replace_nulls(), PG_ARGISNULL, PG_GETARG_DATUM, PG_RETURN_DATUM, and pg_sub_s32_overflow().
| Datum array_prepend_support | ( | PG_FUNCTION_ARGS | ) |
Definition at line 285 of file array_userfuncs.c.
References arg, fb(), IsA, lsecond, PARAM_EXTERN, PG_GETARG_POINTER, and PG_RETURN_POINTER.
| Datum array_reverse | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1850 of file array_userfuncs.c.
References ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, array_reverse_n(), fb(), lookup_type_cache(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_ARRAYTYPE_P, and TypeCacheEntry::type_id.
|
static |
Definition at line 1775 of file array_userfuncs.c.
References ARR_DIMS, ARR_LBOUND, ARR_NDIM, construct_md_array(), deconstruct_array(), fb(), i, j, MAXDIM, pfree(), TypeCacheEntry::typalign, TypeCacheEntry::typbyval, and TypeCacheEntry::typlen.
Referenced by array_reverse().
| Datum array_sample | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1736 of file array_userfuncs.c.
References ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, array_shuffle_n(), ereport, errcode(), errmsg(), ERROR, fb(), 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 1702 of file array_userfuncs.c.
References ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, array_shuffle_n(), fb(), lookup_type_cache(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_ARRAYTYPE_P, and TypeCacheEntry::type_id.
|
static |
Definition at line 1613 of file array_userfuncs.c.
References ARR_DIMS, ARR_LBOUND, ARR_NDIM, Assert, construct_empty_array(), construct_md_array(), deconstruct_array(), fb(), 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().
| Datum array_sort | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2005 of file array_userfuncs.c.
References array_sort_internal(), PG_GETARG_ARRAYTYPE_P, and PG_RETURN_ARRAYTYPE_P.
|
static |
Definition at line 1883 of file array_userfuncs.c.
References accumArrayResultAny(), ARR_DIMS, ARR_ELEMTYPE, ARR_LBOUND, ARR_NDIM, array_create_iterator(), array_free_iterator(), array_iterate(), array_iterator(), CurrentMemoryContext, DatumGetArrayTypeP, ereport, errcode(), errmsg(), ERROR, fb(), FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_extra, FmgrInfo::fn_mcxt, format_type_be(), TypeCacheEntry::gt_opr, lookup_type_cache(), TypeCacheEntry::lt_opr, makeArrayResultAny(), MemoryContextAllocZero(), OidIsValid, PG_GET_COLLATION, tuplesort_begin_datum(), tuplesort_end(), tuplesort_getdatum(), TUPLESORT_NONE, tuplesort_performsort(), tuplesort_putdatum(), TypeCacheEntry::typalign, TypeCacheEntry::typarray, TypeCacheEntry::typbyval, TYPECACHE_GT_OPR, TYPECACHE_LT_OPR, TypeCacheEntry::typlen, value, and work_mem.
Referenced by array_sort(), array_sort_order(), and array_sort_order_nulls_first().
| Datum array_sort_order | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2016 of file array_userfuncs.c.
References array_sort_internal(), fb(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_BOOL, and PG_RETURN_ARRAYTYPE_P.
| Datum array_sort_order_nulls_first | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2028 of file array_userfuncs.c.
References array_sort_internal(), fb(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_BOOL, and PG_RETURN_ARRAYTYPE_P.
|
static |
Definition at line 80 of file array_userfuncs.c.
References AggCheckCallContext(), construct_empty_expanded_array(), CurrentMemoryContext, ereport, errcode(), errmsg(), ERROR, fb(), FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_extra, FmgrInfo::fn_mcxt, get_element_type(), get_fn_expr_argtype(), InvalidOid, MemoryContextAlloc(), MemoryContextSwitchTo(), OidIsValid, PG_ARGISNULL, and PG_GETARG_EXPANDED_ARRAYX.
Referenced by array_append(), and array_prepend().