|
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/memutils.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 |
| typedef struct DeserialIOData DeserialIOData |
| typedef struct SerialIOData SerialIOData |
| Datum array_agg_array_combine | ( | PG_FUNCTION_ARGS | ) |
Definition at line 978 of file array_userfuncs.c.
References AggCheckCallContext(), array_bitmap_copy(), Assert, elog, ereport, errcode(), errmsg, ERROR, fb(), i, initArrayResultArr(), InvalidOid, Max, MaxArraySize, memcpy(), MemoryContextSwitchTo(), palloc(), pg_add_s32_overflow(), 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 1194 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, buf, CurrentMemoryContext, fb(), initArrayResultArr(), initReadOnlyStringInfo(), memcpy(), palloc(), PG_GETARG_BYTEA_PP, PG_RETURN_POINTER, pq_getmsgbytes(), pq_getmsgend(), pq_getmsgint(), result, VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
| Datum array_agg_array_finalfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1277 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, CurrentMemoryContext, fb(), makeArrayResultArr(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_DATUM, PG_RETURN_NULL, and result.
| Datum array_agg_array_serialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1135 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, buf, fb(), PG_GETARG_POINTER, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendbytes(), pq_sendint32(), and result.
| Datum array_agg_array_transfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 934 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 602 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, datumCopy(), elog, ERROR, fb(), i, initArrayResultWithSize(), memcpy(), 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 788 of file array_userfuncs.c.
References AggCheckCallContext(), buf, CurrentMemoryContext, elog, ereport, errcode(), errmsg, ERROR, fb(), fmgr_info_cxt(), getTypeBinaryInputInfo(), i, initArrayResultWithSize(), initReadOnlyStringInfo(), memcpy(), MemoryContextAlloc(), PG_GETARG_BYTEA_PP, PG_RETURN_POINTER, pq_getmsgbyte(), pq_getmsgbytes(), pq_getmsgend(), pq_getmsgint(), pq_getmsgint64(), ReceiveFunctionCall(), result, VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
| Datum array_agg_finalfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 899 of file array_userfuncs.c.
References AggCheckCallContext(), Assert, CurrentMemoryContext, fb(), makeMdArrayResult(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_DATUM, PG_RETURN_NULL, and result.
| Datum array_agg_serialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 699 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(), result, SendFunctionCall(), VARDATA(), VARHDRSZ, and VARSIZE().
| Datum array_agg_transfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 556 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 140 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, PG_RETURN_DATUM, and result.
| Datum array_append_support | ( | PG_FUNCTION_ARGS | ) |
Definition at line 193 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 317 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(), ereport, errcode(), errdetail(), errmsg, ERROR, fb(), format_type_be(), i, memcpy(), nitems, palloc0(), palloc_array, PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_RETURN_ARRAYTYPE_P, PG_RETURN_NULL, result, and SET_VARSIZE().
| Datum array_position | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1310 of file array_userfuncs.c.
References array_position_common().
|
static |
Definition at line 1329 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 1316 of file array_userfuncs.c.
References array_position_common().
| Datum array_positions | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1484 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 223 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, pg_sub_s32_overflow(), and result.
| Datum array_prepend_support | ( | PG_FUNCTION_ARGS | ) |
Definition at line 286 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 1859 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, result, and TypeCacheEntry::type_id.
|
static |
Definition at line 1784 of file array_userfuncs.c.
References ARR_DIMS, ARR_LBOUND, ARR_NDIM, construct_md_array(), deconstruct_array(), fb(), i, j, MAXDIM, memcpy(), pfree(), result, TypeCacheEntry::typalign, TypeCacheEntry::typbyval, and TypeCacheEntry::typlen.
Referenced by array_reverse().
| Datum array_sample | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1745 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, result, and TypeCacheEntry::type_id.
| Datum array_shuffle | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1711 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, result, and TypeCacheEntry::type_id.
|
static |
Definition at line 1622 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, memcpy(), pfree(), pg_global_prng_state, pg_prng_uint64_range(), result, TypeCacheEntry::typalign, TypeCacheEntry::typbyval, and TypeCacheEntry::typlen.
Referenced by array_sample(), and array_shuffle().
| Datum array_sort | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2014 of file array_userfuncs.c.
References array_sort_internal(), PG_GETARG_ARRAYTYPE_P, and PG_RETURN_ARRAYTYPE_P.
|
static |
Definition at line 1892 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 2025 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 2037 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 81 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().