PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <ctype.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include "common/hashfn.h"
#include "common/int.h"
#include "funcapi.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
#include "nodes/supportnodes.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/numeric.h"
#include "utils/pg_lsn.h"
#include "utils/sortsupport.h"
Go to the source code of this file.
Data Structures | |
struct | NumericShort |
struct | NumericLong |
union | NumericChoice |
struct | NumericData |
struct | NumericVar |
struct | generate_series_numeric_fctx |
struct | NumericSortSupport |
struct | NumericSumAccum |
struct | NumericAggState |
struct | Int8TransTypeData |
Typedefs | |
typedef int16 | NumericDigit |
typedef struct NumericVar | NumericVar |
typedef struct NumericSumAccum | NumericSumAccum |
typedef struct NumericAggState | NumericAggState |
typedef NumericAggState | PolyNumAggState |
typedef struct Int8TransTypeData | Int8TransTypeData |
Variables | |
static const NumericDigit | const_zero_data [1] = {0} |
static const NumericVar | const_zero |
static const NumericDigit | const_one_data [1] = {1} |
static const NumericVar | const_one |
static const NumericVar | const_minus_one |
static const NumericDigit | const_two_data [1] = {2} |
static const NumericVar | const_two |
static const NumericDigit | const_zero_point_nine_data [1] = {9000} |
static const NumericVar | const_zero_point_nine |
static const NumericDigit | const_one_point_one_data [2] = {1, 1000} |
static const NumericVar | const_one_point_one |
static const NumericVar | const_nan |
static const NumericVar | const_pinf |
static const NumericVar | const_ninf |
static const int | round_powers [4] = {0, 1000, 100, 10} |
#define digitbuf_alloc | ( | ndigits | ) | ((NumericDigit *) palloc((ndigits) * sizeof(NumericDigit))) |
#define digitbuf_free | ( | buf | ) |
#define init_var | ( | v | ) | memset(v, 0, sizeof(NumericVar)) |
#define makePolyNumAggState makeNumericAggState |
#define makePolyNumAggStateCurrentContext makeNumericAggStateCurrentContext |
#define NA_TOTAL_COUNT | ( | na | ) | ((na)->N + (na)->NaNcount + (na)->pInfcount + (na)->nInfcount) |
#define NUMERIC_ABBREV_BITS (SIZEOF_DATUM * BITS_PER_BYTE) |
#define NUMERIC_ABBREV_NAN NumericAbbrevGetDatum(PG_INT32_MIN) |
#define NUMERIC_ABBREV_NINF NumericAbbrevGetDatum(PG_INT32_MAX) |
#define NUMERIC_ABBREV_PINF NumericAbbrevGetDatum(-PG_INT32_MAX) |
#define NUMERIC_CAN_BE_SHORT | ( | scale, | |
weight | |||
) |
#define NUMERIC_DIGITS | ( | num | ) |
#define NUMERIC_DSCALE | ( | n | ) |
#define NUMERIC_DSCALE_MAX NUMERIC_DSCALE_MASK |
#define NUMERIC_EXT_FLAGBITS | ( | n | ) | ((n)->choice.n_header & NUMERIC_EXT_SIGN_MASK) |
#define NUMERIC_EXT_SIGN_MASK 0xF000 /* high bits plus NaN/Inf flag bits */ |
#define NUMERIC_FLAGBITS | ( | n | ) | ((n)->choice.n_header & NUMERIC_SIGN_MASK) |
#define NUMERIC_HEADER_IS_SHORT | ( | n | ) | (((n)->choice.n_header & 0x8000) != 0) |
#define NUMERIC_HEADER_SIZE | ( | n | ) |
#define NUMERIC_IS_INF | ( | n | ) | (((n)->choice.n_header & ~NUMERIC_INF_SIGN_MASK) == NUMERIC_PINF) |
#define NUMERIC_IS_NAN | ( | n | ) | ((n)->choice.n_header == NUMERIC_NAN) |
#define NUMERIC_IS_NINF | ( | n | ) | ((n)->choice.n_header == NUMERIC_NINF) |
#define NUMERIC_IS_PINF | ( | n | ) | ((n)->choice.n_header == NUMERIC_PINF) |
#define NUMERIC_IS_SHORT | ( | n | ) | (NUMERIC_FLAGBITS(n) == NUMERIC_SHORT) |
#define NUMERIC_IS_SPECIAL | ( | n | ) | (NUMERIC_FLAGBITS(n) == NUMERIC_SPECIAL) |
#define NUMERIC_NDIGITS | ( | num | ) | ((VARSIZE(num) - NUMERIC_HEADER_SIZE(num)) / sizeof(NumericDigit)) |
#define NUMERIC_SHORT_DSCALE_MAX (NUMERIC_SHORT_DSCALE_MASK >> NUMERIC_SHORT_DSCALE_SHIFT) |
#define NUMERIC_SHORT_WEIGHT_MAX NUMERIC_SHORT_WEIGHT_MASK |
#define NUMERIC_SHORT_WEIGHT_MIN (-(NUMERIC_SHORT_WEIGHT_MASK+1)) |
#define NUMERIC_SIGN | ( | n | ) |
#define NUMERIC_WEIGHT | ( | n | ) |
#define NUMERIC_WEIGHT_MAX PG_INT16_MAX |
#define PRODSUM1 | ( | v1, | |
i1, | |||
v2, | |||
i2 | |||
) | ((v1)[(i1)] * (v2)[(i2)]) |
#define PRODSUM2 | ( | v1, | |
i1, | |||
v2, | |||
i2 | |||
) | (PRODSUM1(v1,i1,v2,i2) + (v1)[(i1)+1] * (v2)[(i2)-1]) |
#define PRODSUM3 | ( | v1, | |
i1, | |||
v2, | |||
i2 | |||
) | (PRODSUM2(v1,i1,v2,i2) + (v1)[(i1)+2] * (v2)[(i2)-2]) |
#define PRODSUM4 | ( | v1, | |
i1, | |||
v2, | |||
i2 | |||
) | (PRODSUM3(v1,i1,v2,i2) + (v1)[(i1)+3] * (v2)[(i2)-3]) |
#define PRODSUM5 | ( | v1, | |
i1, | |||
v2, | |||
i2 | |||
) | (PRODSUM4(v1,i1,v2,i2) + (v1)[(i1)+4] * (v2)[(i2)-4]) |
#define PRODSUM6 | ( | v1, | |
i1, | |||
v2, | |||
i2 | |||
) | (PRODSUM5(v1,i1,v2,i2) + (v1)[(i1)+5] * (v2)[(i2)-5]) |
typedef struct Int8TransTypeData Int8TransTypeData |
typedef struct NumericAggState NumericAggState |
typedef int16 NumericDigit |
typedef struct NumericSumAccum NumericSumAccum |
typedef struct NumericVar NumericVar |
typedef NumericAggState PolyNumAggState |
|
static |
Definition at line 12212 of file numeric.c.
References accum_sum_carry(), accum_sum_rescale(), i, NBASE, NumericSumAccum::neg_digits, NumericSumAccum::num_uncarried, NUMERIC_POS, NumericSumAccum::pos_digits, val, and NumericSumAccum::weight.
Referenced by accum_sum_combine(), do_numeric_accum(), do_numeric_discard(), int8_avg_deserialize(), numeric_avg_deserialize(), numeric_deserialize(), and numeric_poly_deserialize().
|
static |
Definition at line 12260 of file numeric.c.
References Assert, NumericSumAccum::have_carry_space, i, NBASE, NumericSumAccum::ndigits, NumericSumAccum::neg_digits, NumericSumAccum::num_uncarried, and NumericSumAccum::pos_digits.
Referenced by accum_sum_add(), and accum_sum_final().
|
static |
Definition at line 12490 of file numeric.c.
References accum_sum_add(), accum_sum_final(), free_var(), and init_var.
Referenced by int8_avg_combine(), numeric_avg_combine(), numeric_combine(), and numeric_poly_combine().
|
static |
Definition at line 12473 of file numeric.c.
References NumericSumAccum::dscale, NumericSumAccum::ndigits, NumericSumAccum::neg_digits, NumericSumAccum::num_uncarried, palloc(), NumericSumAccum::pos_digits, and NumericSumAccum::weight.
Referenced by int8_avg_combine(), numeric_avg_combine(), numeric_combine(), and numeric_poly_combine().
|
static |
Definition at line 12422 of file numeric.c.
References accum_sum_carry(), add_var(), Assert, NumericVar::buf, const_zero, digitbuf_alloc, NumericVar::digits, NumericVar::dscale, NumericSumAccum::dscale, i, init_var, NBASE, NumericVar::ndigits, NumericSumAccum::ndigits, NumericSumAccum::neg_digits, NUMERIC_NEG, NUMERIC_POS, NumericSumAccum::pos_digits, set_var_from_var(), NumericVar::sign, strip_var(), NumericVar::weight, and NumericSumAccum::weight.
Referenced by accum_sum_combine(), int8_avg_serialize(), numeric_avg(), numeric_avg_serialize(), numeric_poly_serialize(), numeric_serialize(), numeric_stddev_internal(), and numeric_sum().
|
static |
Definition at line 12333 of file numeric.c.
References Assert, NumericSumAccum::dscale, NumericSumAccum::have_carry_space, NumericSumAccum::ndigits, NumericSumAccum::neg_digits, palloc0(), pfree(), NumericSumAccum::pos_digits, val, and NumericSumAccum::weight.
Referenced by accum_sum_add().
|
static |
Definition at line 12196 of file numeric.c.
References NumericSumAccum::dscale, i, NumericSumAccum::ndigits, NumericSumAccum::neg_digits, and NumericSumAccum::pos_digits.
Referenced by do_numeric_discard().
|
static |
Definition at line 11820 of file numeric.c.
References Assert, NumericVar::buf, digitbuf_alloc, digitbuf_free, NumericVar::digits, NumericVar::dscale, i, Max, NBASE, NumericVar::ndigits, strip_var(), and NumericVar::weight.
|
static |
Definition at line 8428 of file numeric.c.
References add_abs(), cmp_abs(), NumericVar::dscale, Max, NUMERIC_NEG, NUMERIC_POS, NumericVar::sign, sub_abs(), and zero_var().
Referenced by accum_sum_final(), ceil_var(), compute_bucket(), div_mod_var(), exp_var(), generate_series_step_numeric(), in_range_numeric_numeric(), ln_var(), numeric_add_opt_error(), numeric_inc(), random_var(), set_var_from_non_decimal_integer_str(), sqrt_var(), and width_bucket_numeric().
|
static |
Definition at line 6950 of file numeric.c.
References NumericVar::buf, digitbuf_alloc, digitbuf_free, NumericVar::digits, and NumericVar::ndigits.
Referenced by div_var(), int64_to_numericvar(), mul_var(), numeric_recv(), numericvar_deserialize(), random_var(), set_var_from_num(), set_var_from_str(), and sqrt_var().
|
static |
Definition at line 7904 of file numeric.c.
References DEC_DIGITS, NumericVar::digits, NumericVar::dscale, ereturn, errcode(), errdetail(), errmsg(), i, is_valid_numeric_typmod(), maxdigits, NumericVar::ndigits, numeric_typmod_precision(), numeric_typmod_scale(), round_var(), scale, and NumericVar::weight.
Referenced by numeric(), numeric_in(), and numeric_recv().
Definition at line 7989 of file numeric.c.
References Assert, ereturn, errcode(), errdetail(), errmsg(), is_valid_numeric_typmod(), NUMERIC_IS_NAN, NUMERIC_IS_SPECIAL, numeric_typmod_precision(), numeric_typmod_scale(), and scale.
Referenced by numeric(), numeric_in(), and numeric_recv().
|
static |
Definition at line 10181 of file numeric.c.
References add_var(), cmp_var(), const_one, free_var(), init_var, NUMERIC_POS, set_var_from_var(), NumericVar::sign, and trunc_var().
Referenced by numeric_ceil().
|
static |
Definition at line 11742 of file numeric.c.
References cmp_abs_common(), NumericVar::digits, NumericVar::ndigits, and NumericVar::weight.
Referenced by add_var(), div_mod_var(), gcd_var(), and sub_var().
|
static |
Definition at line 11756 of file numeric.c.
Referenced by cmp_abs(), and cmp_var_common().
Definition at line 2502 of file numeric.c.
References cmp_var_common(), NUMERIC_DIGITS, NUMERIC_IS_NAN, NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, NUMERIC_NDIGITS, NUMERIC_SIGN, and NUMERIC_WEIGHT.
Referenced by numeric_cmp(), numeric_eq(), numeric_fast_cmp(), numeric_ge(), numeric_gt(), numeric_larger(), numeric_le(), numeric_lt(), numeric_ne(), numeric_smaller(), and width_bucket_numeric().
|
static |
Definition at line 8370 of file numeric.c.
References cmp_var_common(), NumericVar::digits, NumericVar::ndigits, NumericVar::sign, and NumericVar::weight.
Referenced by ceil_var(), estimate_ln_dweight(), floor_var(), generate_series_step_numeric(), in_range_numeric_numeric(), ln_var(), numeric_power(), numeric_stddev_internal(), power_var(), random_var(), and sqrt_var().
|
static |
Definition at line 8385 of file numeric.c.
References cmp_abs_common(), NUMERIC_NEG, and NUMERIC_POS.
Referenced by cmp_numerics(), and cmp_var().
|
static |
Definition at line 1933 of file numeric.c.
References add_var(), const_one, div_var(), NumericVar::dscale, free_var(), init_var_from_num(), mul_var(), and sub_var().
Referenced by width_bucket_numeric().
|
static |
Definition at line 10111 of file numeric.c.
References add_var(), cmp_abs(), const_one, div_var(), NumericVar::dscale, free_var(), init_var, mul_var(), NumericVar::ndigits, set_var_from_var(), NumericVar::sign, and sub_var().
Referenced by sqrt_var().
|
static |
Definition at line 9244 of file numeric.c.
References alloc_var(), Assert, DEC_DIGITS, NumericVar::digits, DIV_GUARD_DIGITS, div_var_int(), NumericVar::dscale, ereport, errcode(), errmsg(), ERROR, i, i64abs, if(), Max, Min, NBASE, NBASE_SQR, NumericVar::ndigits, NUMERIC_NEG, NUMERIC_POS, palloc(), pfree(), PG_INT64_MAX, round_var(), NumericVar::sign, strip_var(), trunc_var(), NumericVar::weight, and zero_var().
Referenced by compute_bucket(), div_mod_var(), get_str_from_var_sci(), ln_var(), log_var(), mod_var(), numeric_div_opt_error(), numeric_div_trunc(), numeric_lcm(), numeric_stddev_internal(), and power_var_int().
|
static |
Definition at line 9785 of file numeric.c.
References NumericVar::buf, DEC_DIGITS, digitbuf_alloc, digitbuf_free, NumericVar::digits, NumericVar::dscale, ereport, errcode(), errmsg(), ERROR, i, Max, NBASE, NumericVar::ndigits, NUMERIC_NEG, NUMERIC_POS, round_var(), NumericVar::sign, strip_var(), trunc_var(), NumericVar::weight, and zero_var().
|
static |
Definition at line 4854 of file numeric.c.
References accum_sum_add(), NumericVar::dscale, init_var, init_var_from_num(), MemoryContextSwitchTo(), mul_var(), newval, NUMERIC_IS_NINF, NUMERIC_IS_PINF, and NUMERIC_IS_SPECIAL.
Referenced by int2_accum(), int4_accum(), int8_accum(), int8_avg_accum(), numeric_accum(), and numeric_avg_accum().
|
static |
Definition at line 4924 of file numeric.c.
References accum_sum_add(), accum_sum_reset(), Assert, NumericVar::dscale, init_var, init_var_from_num(), MemoryContextSwitchTo(), mul_var(), newval, NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, NUMERIC_NEG, NUMERIC_POS, and NumericVar::sign.
Referenced by int2_accum_inv(), int4_accum_inv(), int8_accum_inv(), int8_avg_accum_inv(), and numeric_accum_inv().
Definition at line 7760 of file numeric.c.
References palloc(), res, and VARSIZE.
Referenced by numeric(), numeric_abs(), numeric_ceil(), numeric_exp(), numeric_floor(), numeric_inc(), numeric_ln(), numeric_mod_opt_error(), numeric_round(), numeric_sqrt(), numeric_trim_scale(), numeric_trunc(), numeric_uminus(), and numeric_uplus().
|
static |
Definition at line 10907 of file numeric.c.
References cmp_var(), const_one, const_one_point_one, const_zero_point_nine, DEC_DIGITS, NumericVar::digits, digits, free_var(), init_var, ln_var(), NBASE, NumericVar::ndigits, NUMERIC_POS, NumericVar::sign, sub_var(), NumericVar::weight, and x.
Referenced by log_var(), numeric_ln(), and power_var().
|
static |
Definition at line 10778 of file numeric.c.
References add_var(), arg, const_one, DEC_DIGITS, div_var_int(), NumericVar::dscale, ereport, errcode(), errmsg(), ERROR, free_var(), init_var, Max, mul_var(), NumericVar::ndigits, NUMERIC_MAX_RESULT_SCALE, NUMERIC_MIN_DISPLAY_SCALE, numericvar_to_double_no_overflow(), round_var(), set_var_from_var(), val, NumericVar::weight, x, and zero_var().
Referenced by numeric_exp(), and power_var().
Datum float4_numeric | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4684 of file numeric.c.
References buf, const_nan, const_ninf, const_pinf, free_var(), init_var, make_result(), PG_GETARG_FLOAT4, PG_RETURN_NUMERIC, res, set_var_from_str(), snprintf, and val.
Referenced by JsonItemFromDatum().
Datum float8_numeric | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4590 of file numeric.c.
References buf, const_nan, const_ninf, const_pinf, free_var(), init_var, make_result(), PG_GETARG_FLOAT8, PG_RETURN_NUMERIC, res, set_var_from_str(), snprintf, and val.
Referenced by executeItemOptUnwrapTarget(), JsonItemFromDatum(), and SV_to_JsonbValue().
|
static |
Definition at line 10205 of file numeric.c.
References cmp_var(), const_one, free_var(), init_var, NUMERIC_NEG, set_var_from_var(), NumericVar::sign, sub_var(), and trunc_var().
Referenced by numeric_floor().
|
static |
Definition at line 6966 of file numeric.c.
References NumericVar::buf, digitbuf_free, NumericVar::digits, NUMERIC_NAN, and NumericVar::sign.
Referenced by accum_sum_combine(), ceil_var(), compute_bucket(), div_mod_var(), estimate_ln_dweight(), exp_var(), float4_numeric(), float8_numeric(), floor_var(), gcd_var(), get_str_from_var_sci(), in_range_numeric_numeric(), int64_div_fast_to_numeric(), int64_to_numeric(), int8_avg_deserialize(), int8_avg_serialize(), ln_var(), log_var(), mod_var(), numeric(), numeric_add_opt_error(), numeric_avg(), numeric_avg_deserialize(), numeric_avg_serialize(), numeric_ceil(), numeric_deserialize(), numeric_div_opt_error(), numeric_div_trunc(), numeric_exp(), numeric_fac(), numeric_floor(), numeric_gcd(), numeric_in(), numeric_inc(), numeric_lcm(), numeric_ln(), numeric_log(), numeric_min_scale(), numeric_mod_opt_error(), numeric_mul_opt_error(), numeric_poly_avg(), numeric_poly_deserialize(), numeric_poly_serialize(), numeric_poly_sum(), numeric_power(), numeric_recv(), numeric_round(), numeric_serialize(), numeric_sqrt(), numeric_stddev_internal(), numeric_sub_opt_error(), numeric_sum(), numeric_trim_scale(), numeric_trunc(), numericvar_to_int64(), numericvar_to_uint64(), power_var(), power_var_int(), random_numeric(), random_var(), set_var_from_non_decimal_integer_str(), sqrt_var(), and width_bucket_numeric().
|
static |
Definition at line 10228 of file numeric.c.
References CHECK_FOR_INTERRUPTS, cmp(), cmp_abs(), NumericVar::dscale, free_var(), init_var, Max, mod_var(), NumericVar::ndigits, NUMERIC_POS, set_var_from_var(), and NumericVar::sign.
Referenced by numeric_gcd(), and numeric_lcm().
Datum generate_series_numeric | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1702 of file numeric.c.
References generate_series_step_numeric().
Datum generate_series_step_numeric | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1708 of file numeric.c.
References add_var(), cmp_var(), const_one, const_zero, generate_series_numeric_fctx::current, ereport, errcode(), errmsg(), ERROR, init_var, init_var_from_num(), make_result(), MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, NUMERIC_IS_NAN, NUMERIC_IS_SPECIAL, NUMERIC_NEG, NUMERIC_POS, NumericGetDatum(), palloc(), PG_GETARG_NUMERIC, PG_NARGS, set_var_from_num(), set_var_from_var(), NumericVar::sign, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, generate_series_numeric_fctx::step, generate_series_numeric_fctx::stop, and FuncCallContext::user_fctx.
Referenced by generate_series_numeric().
|
static |
Definition at line 4133 of file numeric.c.
References DEC_DIGITS, NumericVar::digits, NumericVar::ndigits, and NumericVar::weight.
Referenced by numeric_min_scale(), and numeric_trim_scale().
|
static |
Definition at line 7491 of file numeric.c.
References DEC_DIGITS, NumericVar::digits, NumericVar::dscale, i, NumericVar::ndigits, NUMERIC_NEG, palloc(), NumericVar::sign, str, and NumericVar::weight.
Referenced by get_str_from_var_sci(), numeric_normalize(), numeric_out(), and numericvar_to_double_no_overflow().
|
static |
Definition at line 7644 of file numeric.c.
References DEC_DIGITS, NumericVar::digits, div_var(), free_var(), get_str_from_var(), init_var, len, NumericVar::ndigits, palloc(), pfree(), power_ten_int(), snprintf, str, and NumericVar::weight.
Referenced by numeric_out_sci().
Datum hash_numeric | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2694 of file numeric.c.
References Assert, digits, hash_any(), i, sort-test::key, NUMERIC_DIGITS, NUMERIC_IS_SPECIAL, NUMERIC_NDIGITS, NUMERIC_WEIGHT, PG_GETARG_NUMERIC, PG_RETURN_DATUM, and PG_RETURN_UINT32.
Referenced by JsonbHashScalarValue().
Datum hash_numeric_extended | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2774 of file numeric.c.
References Assert, DatumGetUInt64(), digits, hash_any_extended(), i, sort-test::key, NUMERIC_DIGITS, NUMERIC_IS_SPECIAL, NUMERIC_NDIGITS, NUMERIC_WEIGHT, PG_GETARG_INT64, PG_GETARG_NUMERIC, PG_RETURN_DATUM, PG_RETURN_UINT64, and UInt64GetDatum().
Referenced by JsonbHashScalarValueExtended().
Datum in_range_numeric_numeric | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2559 of file numeric.c.
References add_var(), Assert, cmp_var(), ereport, errcode(), errmsg(), ERROR, free_var(), init_var, init_var_from_num(), NUMERIC_IS_NAN, NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, NUMERIC_NEG, NUMERIC_SIGN, PG_FREE_IF_COPY, PG_GETARG_BOOL, PG_GETARG_NUMERIC, PG_RETURN_BOOL, sub_var(), and val.
|
static |
Definition at line 7448 of file numeric.c.
References generate_unaccent_rules::dest, NUMERIC_DIGITS, NUMERIC_DSCALE, NUMERIC_NDIGITS, NUMERIC_SIGN, and NUMERIC_WEIGHT.
Referenced by compute_bucket(), do_numeric_accum(), do_numeric_discard(), generate_series_step_numeric(), in_range_numeric_numeric(), numeric_abbrev_convert(), numeric_add_opt_error(), numeric_ceil(), numeric_div_opt_error(), numeric_div_trunc(), numeric_exp(), numeric_float8_no_overflow(), numeric_floor(), numeric_gcd(), numeric_inc(), numeric_int2(), numeric_int4_opt_error(), numeric_int8_opt_error(), numeric_is_integral(), numeric_lcm(), numeric_ln(), numeric_log(), numeric_min_scale(), numeric_mod_opt_error(), numeric_mul_opt_error(), numeric_normalize(), numeric_out(), numeric_out_sci(), numeric_pg_lsn(), numeric_power(), numeric_send(), numeric_sqrt(), numeric_sub_opt_error(), numeric_trim_scale(), and random_numeric().
Datum int2_accum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5547 of file numeric.c.
References do_numeric_accum(), int64_to_numeric(), makePolyNumAggState, PG_ARGISNULL, PG_GETARG_INT16, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum int2_accum_inv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5971 of file numeric.c.
References do_numeric_discard(), elog, ERROR, int64_to_numeric(), PG_ARGISNULL, PG_GETARG_INT16, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum int2_avg_accum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6654 of file numeric.c.
References AggCheckCallContext(), ARR_DATA_PTR, ARR_HASNULL, ARR_OVERHEAD_NONULLS, ARR_SIZE, Int8TransTypeData::count, elog, ERROR, newval, PG_GETARG_ARRAYTYPE_P, PG_GETARG_ARRAYTYPE_P_COPY, PG_GETARG_INT16, PG_RETURN_ARRAYTYPE_P, and Int8TransTypeData::sum.
Datum int2_avg_accum_inv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6741 of file numeric.c.
References AggCheckCallContext(), ARR_DATA_PTR, ARR_HASNULL, ARR_OVERHEAD_NONULLS, ARR_SIZE, Int8TransTypeData::count, elog, ERROR, newval, PG_GETARG_ARRAYTYPE_P, PG_GETARG_ARRAYTYPE_P_COPY, PG_GETARG_INT16, PG_RETURN_ARRAYTYPE_P, and Int8TransTypeData::sum.
Datum int2_numeric | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4541 of file numeric.c.
References int64_to_numeric(), PG_GETARG_INT16, PG_RETURN_NUMERIC, and val.
Referenced by JsonItemFromDatum().
Datum int2_sum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6505 of file numeric.c.
References AggCheckCallContext(), newval, PG_ARGISNULL, PG_GETARG_INT16, PG_GETARG_INT64, PG_GETARG_POINTER, PG_RETURN_INT64, PG_RETURN_NULL, and PG_RETURN_POINTER.
Datum int2int4_sum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6824 of file numeric.c.
References ARR_DATA_PTR, ARR_HASNULL, ARR_OVERHEAD_NONULLS, ARR_SIZE, Int8TransTypeData::count, elog, ERROR, Int64GetDatumFast, PG_GETARG_ARRAYTYPE_P, PG_RETURN_DATUM, PG_RETURN_NULL, and Int8TransTypeData::sum.
Datum int4_accum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5570 of file numeric.c.
References do_numeric_accum(), int64_to_numeric(), makePolyNumAggState, PG_ARGISNULL, PG_GETARG_INT32, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum int4_accum_inv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5996 of file numeric.c.
References do_numeric_discard(), elog, ERROR, int64_to_numeric(), PG_ARGISNULL, PG_GETARG_INT32, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum int4_avg_accum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6682 of file numeric.c.
References AggCheckCallContext(), ARR_DATA_PTR, ARR_HASNULL, ARR_OVERHEAD_NONULLS, ARR_SIZE, Int8TransTypeData::count, elog, ERROR, newval, PG_GETARG_ARRAYTYPE_P, PG_GETARG_ARRAYTYPE_P_COPY, PG_GETARG_INT32, PG_RETURN_ARRAYTYPE_P, and Int8TransTypeData::sum.
Datum int4_avg_accum_inv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6769 of file numeric.c.
References AggCheckCallContext(), ARR_DATA_PTR, ARR_HASNULL, ARR_OVERHEAD_NONULLS, ARR_SIZE, Int8TransTypeData::count, elog, ERROR, newval, PG_GETARG_ARRAYTYPE_P, PG_GETARG_ARRAYTYPE_P_COPY, PG_GETARG_INT32, PG_RETURN_ARRAYTYPE_P, and Int8TransTypeData::sum.
Datum int4_avg_combine | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6710 of file numeric.c.
References AggCheckCallContext(), ARR_DATA_PTR, ARR_HASNULL, ARR_OVERHEAD_NONULLS, ARR_SIZE, Int8TransTypeData::count, elog, ERROR, PG_GETARG_ARRAYTYPE_P, PG_RETURN_ARRAYTYPE_P, and Int8TransTypeData::sum.
Datum int4_numeric | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4386 of file numeric.c.
References int64_to_numeric(), PG_GETARG_INT32, PG_RETURN_NUMERIC, and val.
Referenced by executeItemOptUnwrapTarget(), and JsonItemFromDatum().
Datum int4_sum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6554 of file numeric.c.
References AggCheckCallContext(), newval, PG_ARGISNULL, PG_GETARG_INT32, PG_GETARG_INT64, PG_GETARG_POINTER, PG_RETURN_INT64, PG_RETURN_NULL, and PG_RETURN_POINTER.
Numeric int64_div_fast_to_numeric | ( | int64 | val1, |
int | log10val2 | ||
) |
Definition at line 4301 of file numeric.c.
References DEC_DIGITS, NumericVar::dscale, free_var(), init_var, int64_to_numericvar(), lengthof, make_result(), mul_var(), pg_mul_s64_overflow(), res, StaticAssertDecl, unlikely, and NumericVar::weight.
Referenced by interval_part_common(), time_part_common(), timestamp_part_common(), timestamptz_part_common(), and timetz_part_common().
Numeric int64_to_numeric | ( | int64 | val | ) |
Definition at line 4280 of file numeric.c.
References free_var(), init_var, int64_to_numericvar(), make_result(), res, and val.
Referenced by cash_numeric(), executeItemOptUnwrapTarget(), executeKeyValueMethod(), extract_date(), gbt_numeric_penalty(), int2_accum(), int2_accum_inv(), int2_numeric(), int4_accum(), int4_accum_inv(), int4_numeric(), int8_accum(), int8_accum_inv(), int8_avg(), int8_avg_accum(), int8_avg_accum_inv(), int8_numeric(), int8_sum(), int8_to_char(), interval_part_common(), numeric_avg(), numeric_cash(), numeric_half_rounded(), numeric_poly_avg(), numeric_to_char(), numeric_to_number(), numeric_truncated_divide(), pg_size_bytes(), pg_size_pretty_numeric(), SV_to_JsonbValue(), time_part_common(), timestamp_part_common(), timestamptz_part_common(), and timetz_part_common().
|
static |
Definition at line 8101 of file numeric.c.
References alloc_var(), DEC_DIGITS, NumericVar::digits, NumericVar::dscale, NBASE, NumericVar::ndigits, NUMERIC_NEG, NUMERIC_POS, pg_abs_s64(), NumericVar::sign, val, and NumericVar::weight.
Referenced by int64_div_fast_to_numeric(), int64_to_numeric(), numeric_fac(), numeric_stddev_internal(), set_var_from_non_decimal_integer_str(), sqrt_var(), and width_bucket_numeric().
Datum int8_accum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5593 of file numeric.c.
References do_numeric_accum(), int64_to_numeric(), makeNumericAggState(), PG_ARGISNULL, PG_GETARG_INT64, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum int8_accum_inv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6021 of file numeric.c.
References do_numeric_discard(), elog, ERROR, int64_to_numeric(), PG_ARGISNULL, PG_GETARG_INT64, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum int8_avg | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6797 of file numeric.c.
References ARR_DATA_PTR, ARR_HASNULL, ARR_OVERHEAD_NONULLS, ARR_SIZE, Int8TransTypeData::count, DirectFunctionCall2, elog, ERROR, int64_to_numeric(), numeric_div(), NumericGetDatum(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_DATUM, PG_RETURN_NULL, and Int8TransTypeData::sum.
Datum int8_avg_accum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5789 of file numeric.c.
References do_numeric_accum(), int64_to_numeric(), makePolyNumAggState, PG_ARGISNULL, PG_GETARG_INT64, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum int8_avg_accum_inv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6042 of file numeric.c.
References do_numeric_discard(), elog, ERROR, int64_to_numeric(), PG_ARGISNULL, PG_GETARG_INT64, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum int8_avg_combine | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5816 of file numeric.c.
References accum_sum_combine(), accum_sum_copy(), AggCheckCallContext(), elog, ERROR, makePolyNumAggState, MemoryContextSwitchTo(), NumericAggState::N, PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_POINTER, and NumericAggState::sumX.
Datum int8_avg_deserialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5925 of file numeric.c.
References accum_sum_add(), AggCheckCallContext(), buf, elog, ERROR, free_var(), init_var, initReadOnlyStringInfo(), makePolyNumAggStateCurrentContext, NumericAggState::N, numericvar_deserialize(), PG_GETARG_BYTEA_PP, PG_RETURN_POINTER, pq_getmsgend(), pq_getmsgint64(), NumericAggState::sumX, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum int8_avg_serialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5876 of file numeric.c.
References accum_sum_final(), AggCheckCallContext(), buf, elog, ERROR, free_var(), init_var, numericvar_serialize(), PG_GETARG_POINTER, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), and pq_sendint64().
Datum int8_numeric | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4474 of file numeric.c.
References int64_to_numeric(), PG_GETARG_INT64, PG_RETURN_NUMERIC, and val.
Referenced by executeItemOptUnwrapTarget(), and JsonItemFromDatum().
Datum int8_sum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6606 of file numeric.c.
References DirectFunctionCall2, int64_to_numeric(), numeric_add(), NumericGetDatum(), PG_ARGISNULL, PG_GETARG_INT64, PG_GETARG_NUMERIC, PG_RETURN_DATUM, PG_RETURN_NULL, and PG_RETURN_NUMERIC.
Definition at line 915 of file numeric.c.
References VARHDRSZ.
Referenced by apply_typmod(), apply_typmod_special(), numeric(), numeric_maximum_size(), numeric_support(), and numerictypmodout().
|
static |
Definition at line 10989 of file numeric.c.
References add_var(), arg, cmp(), cmp_var(), const_one, const_one_point_one, const_two, const_zero, const_zero_point_nine, DEC_DIGITS, div_var(), div_var_int(), ereport, errcode(), errmsg(), ERROR, free_var(), init_var, mul_var(), NumericVar::ndigits, set_var_from_var(), sqrt_var(), sub_var(), NumericVar::weight, and x.
Referenced by estimate_ln_dweight(), log_var(), numeric_ln(), and power_var().
|
static |
Definition at line 11107 of file numeric.c.
References div_var(), NumericVar::dscale, estimate_ln_dweight(), free_var(), init_var, ln_var(), Max, Min, NUMERIC_MAX_DISPLAY_SCALE, NUMERIC_MIN_DISPLAY_SCALE, and NUMERIC_MIN_SIG_DIGITS.
Referenced by numeric_log().
|
inlinestatic |
|
static |
Definition at line 7888 of file numeric.c.
References make_result_opt_error().
Referenced by float4_numeric(), float8_numeric(), generate_series_step_numeric(), int64_div_fast_to_numeric(), int64_to_numeric(), numeric(), numeric_add_opt_error(), numeric_avg(), numeric_ceil(), numeric_div_opt_error(), numeric_div_trunc(), numeric_exp(), numeric_fac(), numeric_floor(), numeric_gcd(), numeric_in(), numeric_inc(), numeric_lcm(), numeric_ln(), numeric_log(), numeric_mod_opt_error(), numeric_mul_opt_error(), numeric_poly_avg(), numeric_poly_sum(), numeric_power(), numeric_recv(), numeric_round(), numeric_sign(), numeric_sqrt(), numeric_stddev_internal(), numeric_sub_opt_error(), numeric_sum(), numeric_trim_scale(), numeric_trunc(), and random_numeric().
|
static |
Definition at line 7779 of file numeric.c.
References Assert, NumericData::choice, NumericVar::digits, digits, NumericVar::dscale, dump_numeric, elog, ereport, errcode(), errmsg(), ERROR, len, NumericChoice::n_header, NumericVar::ndigits, NUMERIC_CAN_BE_SHORT, NUMERIC_DIGITS, NUMERIC_DSCALE, NUMERIC_DSCALE_MASK, NUMERIC_HDRSZ, NUMERIC_HDRSZ_SHORT, NUMERIC_NAN, NUMERIC_NDIGITS, NUMERIC_NEG, NUMERIC_NINF, NUMERIC_PINF, NUMERIC_POS, NUMERIC_SHORT, NUMERIC_SHORT_DSCALE_SHIFT, NUMERIC_SHORT_SIGN_MASK, NUMERIC_SHORT_WEIGHT_MASK, NUMERIC_SHORT_WEIGHT_SIGN_MASK, NUMERIC_SIGN_MASK, NUMERIC_SPECIAL, NUMERIC_WEIGHT, palloc(), SET_VARSIZE, NumericVar::sign, sign, and NumericVar::weight.
Referenced by make_result(), numeric_add_opt_error(), numeric_div_opt_error(), numeric_in(), numeric_mod_opt_error(), numeric_mul_opt_error(), and numeric_sub_opt_error().
|
static |
Definition at line 4814 of file numeric.c.
References AggCheckCallContext(), elog, ERROR, MemoryContextSwitchTo(), and palloc0().
Referenced by int8_accum(), numeric_accum(), and numeric_avg_accum().
|
static |
Definition at line 4839 of file numeric.c.
References CurrentMemoryContext, and palloc0().
Referenced by numeric_avg_combine(), numeric_avg_deserialize(), numeric_combine(), and numeric_deserialize().
|
static |
Definition at line 10082 of file numeric.c.
References div_var(), NumericVar::dscale, free_var(), init_var, mul_var(), and sub_var().
Referenced by gcd_var(), and numeric_mod_opt_error().
|
static |
Definition at line 8666 of file numeric.c.
References alloc_var(), Assert, DEC_DIGITS, NumericVar::digits, NumericVar::dscale, i, maxdigits, Min, MUL_GUARD_DIGITS, mul_var_short(), NBASE, NBASE_SQR, NumericVar::ndigits, NUMERIC_NEG, NUMERIC_POS, palloc(), pfree(), PG_UINT64_MAX, round_var(), NumericVar::sign, strip_var(), NumericVar::weight, and zero_var().
Referenced by compute_bucket(), div_mod_var(), do_numeric_accum(), do_numeric_discard(), exp_var(), int64_div_fast_to_numeric(), ln_var(), mod_var(), numeric_fac(), numeric_lcm(), numeric_mul_opt_error(), numeric_stddev_internal(), power_var(), power_var_int(), set_var_from_non_decimal_integer_str(), and sqrt_var().
|
static |
Definition at line 8957 of file numeric.c.
References Assert, NumericVar::buf, digitbuf_alloc, digitbuf_free, NumericVar::digits, NumericVar::dscale, i, NBASE, NumericVar::ndigits, NUMERIC_NEG, NUMERIC_POS, PRODSUM1, PRODSUM2, PRODSUM3, PRODSUM4, PRODSUM5, PRODSUM6, NumericVar::sign, strip_var(), and NumericVar::weight.
Referenced by mul_var().
Definition at line 1245 of file numeric.c.
References apply_typmod(), apply_typmod_special(), NumericData::choice, DEC_DIGITS, duplicate_numeric(), free_var(), init_var, is_valid_numeric_typmod(), make_result(), Max, maxdigits, NumericShort::n_header, NumericChoice::n_short, NUMERIC_CAN_BE_SHORT, NUMERIC_DSCALE, NUMERIC_DSCALE_MASK, NUMERIC_IS_SHORT, NUMERIC_IS_SPECIAL, NUMERIC_SHORT_DSCALE_MASK, NUMERIC_SHORT_DSCALE_SHIFT, NUMERIC_SIGN, numeric_typmod_precision(), numeric_typmod_scale(), NUMERIC_WEIGHT, PG_GETARG_INT32, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, scale, and set_var_from_num().
Referenced by ecpg_set_compat_sqlda(), and ecpg_set_native_sqlda().
|
static |
Definition at line 2111 of file numeric.c.
References NumericSortSupport::abbr_card, elog, estimateHyperLogLog(), NumericSortSupport::estimating, NumericSortSupport::input_count, INT64_FORMAT, LOG, SortSupportData::ssup_extra, and trace_sort.
Referenced by numeric_sortsupport().
|
static |
Definition at line 2049 of file numeric.c.
References Assert, NumericSortSupport::buf, buf, DatumGetPointer(), init_var_from_num(), NumericSortSupport::input_count, numeric_abbrev_convert_var(), NUMERIC_ABBREV_NAN, NUMERIC_ABBREV_NINF, NUMERIC_ABBREV_PINF, NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, pfree(), PG_DETOAST_DATUM_PACKED, SET_VARSIZE, SortSupportData::ssup_extra, value, VARATT_IS_SHORT, VARATT_SHORT_MAX, VARDATA, VARDATA_SHORT, VARHDRSZ, VARHDRSZ_SHORT, and VARSIZE_SHORT.
Referenced by numeric_sortsupport().
|
static |
Referenced by numeric_abbrev_convert().
Datum numeric_abs | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1392 of file numeric.c.
References NumericData::choice, duplicate_numeric(), NumericShort::n_header, NumericChoice::n_short, NUMERIC_DSCALE, NUMERIC_INF_SIGN_MASK, NUMERIC_IS_SHORT, NUMERIC_IS_SPECIAL, NUMERIC_POS, NUMERIC_SHORT_SIGN_MASK, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Referenced by executeItemOptUnwrapTarget(), and numeric_absolute().
Datum numeric_accum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5017 of file numeric.c.
References do_numeric_accum(), makeNumericAggState(), PG_ARGISNULL, PG_GETARG_NUMERIC, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum numeric_accum_inv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5428 of file numeric.c.
References do_numeric_discard(), elog, ERROR, PG_ARGISNULL, PG_GETARG_NUMERIC, PG_GETARG_POINTER, PG_RETURN_NULL, and PG_RETURN_POINTER.
Datum numeric_add | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2845 of file numeric.c.
References numeric_add_opt_error(), PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Referenced by int8_sum(), numeric_half_rounded(), and pg_lsn_pli().
Definition at line 2864 of file numeric.c.
References add_var(), Assert, const_nan, const_ninf, const_pinf, free_var(), init_var, init_var_from_num(), make_result(), make_result_opt_error(), NUMERIC_IS_NAN, NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, and res.
Referenced by executeItemOptUnwrapTarget(), interval_part_common(), numeric_add(), timestamp_part_common(), and timestamptz_part_common().
Datum numeric_avg | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6125 of file numeric.c.
References accum_sum_final(), const_nan, const_ninf, const_pinf, DirectFunctionCall2, free_var(), init_var, int64_to_numeric(), make_result(), NA_TOTAL_COUNT, numeric_div(), NumericGetDatum(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_DATUM, PG_RETURN_NULL, and PG_RETURN_NUMERIC.
Referenced by numeric_poly_avg().
Datum numeric_avg_accum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5109 of file numeric.c.
References do_numeric_accum(), makeNumericAggState(), PG_ARGISNULL, PG_GETARG_NUMERIC, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum numeric_avg_combine | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5129 of file numeric.c.
References accum_sum_combine(), accum_sum_copy(), AggCheckCallContext(), elog, ERROR, makeNumericAggStateCurrentContext(), NumericAggState::maxScale, NumericAggState::maxScaleCount, MemoryContextSwitchTo(), NumericAggState::N, NumericAggState::NaNcount, NumericAggState::nInfcount, PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_POINTER, NumericAggState::pInfcount, and NumericAggState::sumX.
Datum numeric_avg_deserialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5253 of file numeric.c.
References accum_sum_add(), AggCheckCallContext(), buf, elog, ERROR, free_var(), init_var, initReadOnlyStringInfo(), makeNumericAggStateCurrentContext(), NumericAggState::maxScale, NumericAggState::maxScaleCount, NumericAggState::N, NumericAggState::NaNcount, NumericAggState::nInfcount, numericvar_deserialize(), PG_GETARG_BYTEA_PP, PG_RETURN_POINTER, NumericAggState::pInfcount, pq_getmsgend(), pq_getmsgint(), pq_getmsgint64(), NumericAggState::sumX, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum numeric_avg_serialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5201 of file numeric.c.
References accum_sum_final(), AggCheckCallContext(), buf, elog, ERROR, free_var(), init_var, numericvar_serialize(), PG_GETARG_POINTER, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendint32(), and pq_sendint64().
Datum numeric_ceil | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1646 of file numeric.c.
References ceil_var(), duplicate_numeric(), free_var(), init_var_from_num(), make_result(), NUMERIC_IS_SPECIAL, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Referenced by executeItemOptUnwrapTarget().
Datum numeric_cmp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2396 of file numeric.c.
References cmp_numerics(), PG_FREE_IF_COPY, PG_GETARG_NUMERIC, and PG_RETURN_INT32.
Referenced by compareJsonbScalarValue(), compareNumeric(), gbt_numeric_cmp(), and gin_numeric_cmp().
|
static |
Definition at line 2200 of file numeric.c.
References DatumGetNumericAbbrev, x, and y.
Referenced by numeric_sortsupport().
Datum numeric_combine | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5037 of file numeric.c.
References accum_sum_combine(), accum_sum_copy(), AggCheckCallContext(), elog, ERROR, makeNumericAggStateCurrentContext(), NumericAggState::maxScale, NumericAggState::maxScaleCount, MemoryContextSwitchTo(), NumericAggState::N, NumericAggState::NaNcount, NumericAggState::nInfcount, PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_POINTER, NumericAggState::pInfcount, NumericAggState::sumX, and NumericAggState::sumX2.
Datum numeric_deserialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5367 of file numeric.c.
References accum_sum_add(), AggCheckCallContext(), buf, elog, ERROR, free_var(), init_var, initReadOnlyStringInfo(), makeNumericAggStateCurrentContext(), NumericAggState::maxScale, NumericAggState::maxScaleCount, NumericAggState::N, NumericAggState::NaNcount, NumericAggState::nInfcount, numericvar_deserialize(), PG_GETARG_BYTEA_PP, PG_RETURN_POINTER, NumericAggState::pInfcount, pq_getmsgend(), pq_getmsgint(), pq_getmsgint64(), NumericAggState::sumX, NumericAggState::sumX2, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum numeric_div | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3121 of file numeric.c.
References numeric_div_opt_error(), PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Referenced by cash_numeric(), gbt_numeric_penalty(), int8_avg(), numeric_avg(), and numeric_poly_avg().
Definition at line 3141 of file numeric.c.
References Assert, const_nan, const_ninf, const_pinf, const_zero, NumericVar::digits, div_var(), ereport, errcode(), errmsg(), ERROR, free_var(), init_var, init_var_from_num(), make_result(), make_result_opt_error(), NumericVar::ndigits, NUMERIC_IS_NAN, NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, numeric_sign_internal(), res, and select_div_scale().
Referenced by executeItemOptUnwrapTarget(), numeric_div(), timestamp_part_common(), and timestamptz_part_common().
Datum numeric_div_trunc | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3256 of file numeric.c.
References Assert, const_nan, const_ninf, const_pinf, const_zero, div_var(), ereport, errcode(), errmsg(), ERROR, free_var(), init_var, init_var_from_num(), make_result(), NUMERIC_IS_NAN, NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, numeric_sign_internal(), PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Referenced by numeric_half_rounded(), and numeric_truncated_divide().
Datum numeric_eq | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2412 of file numeric.c.
References cmp_numerics(), PG_FREE_IF_COPY, PG_GETARG_NUMERIC, and PG_RETURN_BOOL.
Referenced by equalsJsonbScalarValue(), and gbt_numeric_eq().
Datum numeric_exp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3745 of file numeric.c.
References arg, const_zero, duplicate_numeric(), exp_var(), free_var(), init_var, init_var_from_num(), make_result(), Max, Min, NUMERIC_IS_NINF, NUMERIC_IS_SPECIAL, NUMERIC_MAX_DISPLAY_SCALE, NUMERIC_MAX_RESULT_SCALE, NUMERIC_MIN_DISPLAY_SCALE, NUMERIC_MIN_SIG_DIGITS, numericvar_to_double_no_overflow(), PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, res, and val.
Datum numeric_fac | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3621 of file numeric.c.
References CHECK_FOR_INTERRUPTS, const_one, ereport, errcode(), errmsg(), ERROR, free_var(), init_var, int64_to_numericvar(), make_result(), mul_var(), PG_GETARG_INT64, PG_RETURN_NUMERIC, and res.
|
static |
Definition at line 2178 of file numeric.c.
References cmp_numerics(), DatumGetNumeric(), DatumGetPointer(), pfree(), x, and y.
Referenced by numeric_sortsupport().
Datum numeric_float4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4719 of file numeric.c.
References CStringGetDatum(), DatumGetCString(), DirectFunctionCall1, float4in(), get_float4_infinity(), get_float4_nan(), NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, numeric_out(), NumericGetDatum(), pfree(), PG_GETARG_NUMERIC, PG_RETURN_DATUM, and PG_RETURN_FLOAT4.
Referenced by jsonb_float4().
Datum numeric_float8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4625 of file numeric.c.
References CStringGetDatum(), DatumGetCString(), DirectFunctionCall1, float8in(), get_float8_infinity(), get_float8_nan(), NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, numeric_out(), NumericGetDatum(), pfree(), PG_GETARG_NUMERIC, PG_RETURN_DATUM, and PG_RETURN_FLOAT8.
Referenced by brin_minmax_multi_distance_numeric(), jsonb_float8(), and numrange_subdiff().
Datum numeric_float8_no_overflow | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4658 of file numeric.c.
References get_float8_nan(), init_var_from_num(), NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, numericvar_to_double_no_overflow(), PG_GETARG_NUMERIC, PG_RETURN_FLOAT8, val, and x.
Referenced by convert_numeric_to_scalar(), and gbt_numeric_penalty().
Datum numeric_floor | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1674 of file numeric.c.
References duplicate_numeric(), floor_var(), free_var(), init_var_from_num(), make_result(), NUMERIC_IS_SPECIAL, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Referenced by executeItemOptUnwrapTarget().
Datum numeric_gcd | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3518 of file numeric.c.
References const_nan, free_var(), gcd_var(), init_var, init_var_from_num(), make_result(), NUMERIC_IS_SPECIAL, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Datum numeric_ge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2457 of file numeric.c.
References cmp_numerics(), PG_FREE_IF_COPY, PG_GETARG_NUMERIC, and PG_RETURN_BOOL.
Referenced by gbt_numeric_ge(), and numeric_half_rounded().
Datum numeric_gt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2442 of file numeric.c.
References cmp_numerics(), PG_FREE_IF_COPY, PG_GETARG_NUMERIC, and PG_RETURN_BOOL.
Referenced by gbt_numeric_gt(), and gbt_numeric_penalty().
Datum numeric_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 636 of file numeric.c.
References apply_typmod(), apply_typmod_special(), const_nan, const_ninf, const_pinf, ereturn, errcode(), errmsg(), free_var(), init_var, make_result(), make_result_opt_error(), NUMERIC_NEG, NUMERIC_POS, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_NUMERIC, pg_strncasecmp(), res, set_var_from_non_decimal_integer_str(), set_var_from_str(), sign, str, and value.
Referenced by datum_to_jsonb_internal(), executeItemOptUnwrapTarget(), extract_date(), hstore_to_jsonb_loose(), interval_part_common(), jsonb_in_scalar(), make_const(), numeric_to_number(), pg_lsn_mi(), pg_lsn_mii(), pg_lsn_pli(), pg_size_bytes(), pg_split_walfile_name(), pg_stat_get_activity(), pg_stat_get_wal(), pg_stat_statements_internal(), PLyNumber_ToJsonbValue(), ssl_client_serial(), SV_to_JsonbValue(), timestamp_part_common(), and timestamptz_part_common().
Datum numeric_inc | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3434 of file numeric.c.
References add_var(), arg, const_one, duplicate_numeric(), free_var(), init_var_from_num(), make_result(), NUMERIC_IS_SPECIAL, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Datum numeric_int2 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4550 of file numeric.c.
References ereport, errcode(), errmsg(), ERROR, init_var_from_num(), NUMERIC_IS_NAN, NUMERIC_IS_SPECIAL, numericvar_to_int64(), PG_GETARG_NUMERIC, PG_INT16_MAX, PG_INT16_MIN, PG_RETURN_INT16, unlikely, val, and x.
Referenced by jsonb_int2().
Datum numeric_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4444 of file numeric.c.
References numeric_int4_opt_error(), PG_GETARG_NUMERIC, and PG_RETURN_INT32.
Referenced by jsonb_int4().
Definition at line 4394 of file numeric.c.
References ereport, errcode(), errmsg(), ERROR, init_var_from_num(), NUMERIC_IS_NAN, NUMERIC_IS_SPECIAL, numericvar_to_int32(), and x.
Referenced by executeDateTimeMethod(), executeItemOptUnwrapTarget(), getArrayIndex(), numeric_int4(), and numeric_to_char().
Datum numeric_int8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4532 of file numeric.c.
References numeric_int8_opt_error(), PG_GETARG_NUMERIC, and PG_RETURN_INT64.
Referenced by jsonb_int8(), numeric_cash(), and pg_size_bytes().
Definition at line 4482 of file numeric.c.
References ereport, errcode(), errmsg(), ERROR, init_var_from_num(), NUMERIC_IS_NAN, NUMERIC_IS_SPECIAL, numericvar_to_int64(), and x.
Referenced by executeItemOptUnwrapTarget(), and numeric_int8().
Definition at line 861 of file numeric.c.
References NUMERIC_IS_INF.
Referenced by executeItemOptUnwrapTarget(), and PLyNumber_ToJsonbValue().
Definition at line 872 of file numeric.c.
References arg, init_var_from_num(), NUMERIC_IS_NAN, and NUMERIC_IS_SPECIAL.
Referenced by numeric_power().
Definition at line 850 of file numeric.c.
References NUMERIC_IS_NAN.
Referenced by executeItemOptUnwrapTarget(), gbt_numeric_penalty(), pg_lsn_mii(), pg_lsn_pli(), and PLyNumber_ToJsonbValue().
Datum numeric_larger | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3489 of file numeric.c.
References cmp_numerics(), PG_GETARG_NUMERIC, and PG_RETURN_NUMERIC.
Datum numeric_lcm | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3561 of file numeric.c.
References const_nan, const_zero, div_var(), NumericVar::dscale, free_var(), gcd_var(), init_var, init_var_from_num(), make_result(), Max, mul_var(), NumericVar::ndigits, NUMERIC_IS_SPECIAL, NUMERIC_POS, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, res, set_var_from_var(), and NumericVar::sign.
Datum numeric_le | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2487 of file numeric.c.
References cmp_numerics(), PG_FREE_IF_COPY, PG_GETARG_NUMERIC, and PG_RETURN_BOOL.
Referenced by brin_minmax_multi_distance_numeric(), and gbt_numeric_le().
Datum numeric_ln | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3812 of file numeric.c.
References arg, duplicate_numeric(), ereport, errcode(), errmsg(), ERROR, estimate_ln_dweight(), free_var(), init_var, init_var_from_num(), ln_var(), make_result(), Max, Min, NUMERIC_IS_NINF, NUMERIC_IS_SPECIAL, NUMERIC_MAX_DISPLAY_SCALE, NUMERIC_MIN_DISPLAY_SCALE, NUMERIC_MIN_SIG_DIGITS, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Datum numeric_log | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3861 of file numeric.c.
References Assert, const_nan, const_pinf, const_zero, ereport, errcode(), errmsg(), ERROR, free_var(), init_var, init_var_from_num(), log_var(), make_result(), NUMERIC_IS_NAN, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, numeric_sign_internal(), PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Datum numeric_lt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2472 of file numeric.c.
References cmp_numerics(), PG_FREE_IF_COPY, PG_GETARG_NUMERIC, and PG_RETURN_BOOL.
Referenced by gbt_numeric_lt(), and numeric_is_less().
Definition at line 952 of file numeric.c.
References DEC_DIGITS, is_valid_numeric_typmod(), NUMERIC_HDRSZ, and numeric_typmod_precision().
Referenced by type_maximum_size().
Datum numeric_min_scale | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4184 of file numeric.c.
References arg, free_var(), get_min_scale(), init_var_from_num(), NUMERIC_IS_SPECIAL, PG_GETARG_NUMERIC, PG_RETURN_INT32, and PG_RETURN_NULL.
Datum numeric_mod | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3345 of file numeric.c.
References numeric_mod_opt_error(), PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Definition at line 3365 of file numeric.c.
References const_nan, NumericVar::digits, duplicate_numeric(), ereport, errcode(), errmsg(), ERROR, free_var(), init_var, init_var_from_num(), make_result(), make_result_opt_error(), mod_var(), NumericVar::ndigits, NUMERIC_IS_INF, NUMERIC_IS_NAN, NUMERIC_IS_SPECIAL, numeric_sign_internal(), and res.
Referenced by executeItemOptUnwrapTarget(), and numeric_mod().
Datum numeric_mul | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3000 of file numeric.c.
References numeric_mul_opt_error(), PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Referenced by numeric_cash(), numeric_to_char(), numeric_to_number(), and pg_size_bytes().
Definition at line 3020 of file numeric.c.
References Assert, const_nan, const_ninf, const_pinf, NumericVar::dscale, free_var(), init_var, init_var_from_num(), make_result(), make_result_opt_error(), mul_var(), NUMERIC_DSCALE_MAX, NUMERIC_IS_NAN, NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, numeric_sign_internal(), res, and round_var().
Referenced by executeItemOptUnwrapTarget(), and numeric_mul().
Datum numeric_ne | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2427 of file numeric.c.
References cmp_numerics(), PG_FREE_IF_COPY, PG_GETARG_NUMERIC, and PG_RETURN_BOOL.
char* numeric_normalize | ( | Numeric | num | ) |
Definition at line 1025 of file numeric.c.
References get_str_from_var(), init_var_from_num(), NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, pstrdup(), str, and x.
Referenced by make_scalar_key().
Datum numeric_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 815 of file numeric.c.
References get_str_from_var(), init_var_from_num(), NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, PG_GETARG_NUMERIC, PG_RETURN_CSTRING, pstrdup(), str, and x.
Referenced by ExecGetJsonValueItemString(), executeItemOptUnwrapTarget(), iterate_jsonb_values(), jsonb_put_escaped_value(), JsonbUnquote(), JsonbValue_to_SV(), JsonbValueAsText(), numeric_float4(), numeric_float8(), numeric_to_char(), numeric_to_cstring(), PLyDecimal_FromNumeric(), PLyObject_FromJsonbValue(), populate_scalar(), and printJsonPathItem().
char* numeric_out_sci | ( | Numeric | num, |
int | scale | ||
) |
Definition at line 991 of file numeric.c.
References get_str_from_var_sci(), init_var_from_num(), NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, pstrdup(), scale, str, and x.
Referenced by int8_to_char(), and numeric_to_char().
Datum numeric_pg_lsn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4747 of file numeric.c.
References ereport, errcode(), errmsg(), ERROR, init_var_from_num(), NUMERIC_IS_NAN, NUMERIC_IS_SPECIAL, numericvar_to_uint64(), PG_GETARG_NUMERIC, PG_RETURN_LSN, and x.
Referenced by pg_lsn_mii(), and pg_lsn_pli().
Datum numeric_poly_avg | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6095 of file numeric.c.
References DirectFunctionCall2, free_var(), init_var, int64_to_numeric(), make_result(), numeric_avg(), numeric_div(), NumericGetDatum(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_DATUM, and PG_RETURN_NULL.
Datum numeric_poly_combine | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5613 of file numeric.c.
References accum_sum_combine(), accum_sum_copy(), AggCheckCallContext(), elog, ERROR, makePolyNumAggState, MemoryContextSwitchTo(), NumericAggState::N, PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_POINTER, NumericAggState::sumX, and NumericAggState::sumX2.
Datum numeric_poly_deserialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5736 of file numeric.c.
References accum_sum_add(), AggCheckCallContext(), buf, elog, ERROR, free_var(), init_var, initReadOnlyStringInfo(), makePolyNumAggStateCurrentContext, NumericAggState::N, numericvar_deserialize(), PG_GETARG_BYTEA_PP, PG_RETURN_POINTER, pq_getmsgend(), pq_getmsgint64(), NumericAggState::sumX, NumericAggState::sumX2, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum numeric_poly_serialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5678 of file numeric.c.
References accum_sum_final(), AggCheckCallContext(), buf, elog, ERROR, free_var(), init_var, numericvar_serialize(), PG_GETARG_POINTER, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), and pq_sendint64().
Datum numeric_poly_stddev_pop | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6464 of file numeric.c.
References numeric_stddev_pop(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_NULL, PG_RETURN_NUMERIC, and res.
Datum numeric_poly_stddev_samp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6422 of file numeric.c.
References numeric_stddev_samp(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_NULL, PG_RETURN_NUMERIC, and res.
Datum numeric_poly_sum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6067 of file numeric.c.
References free_var(), init_var, make_result(), numeric_sum(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_NULL, PG_RETURN_NUMERIC, and res.
Datum numeric_poly_var_pop | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6443 of file numeric.c.
References numeric_var_pop(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_NULL, PG_RETURN_NUMERIC, and res.
Datum numeric_poly_var_samp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6401 of file numeric.c.
References numeric_var_samp(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_NULL, PG_RETURN_NUMERIC, and res.
Datum numeric_power | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3932 of file numeric.c.
References Assert, cmp_var(), const_minus_one, const_nan, const_ninf, const_one, const_pinf, const_zero, NumericVar::digits, ereport, errcode(), errmsg(), ERROR, free_var(), init_var, init_var_from_num(), make_result(), NumericVar::ndigits, NUMERIC_IS_INF, numeric_is_integral(), NUMERIC_IS_NAN, NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, NUMERIC_POS, numeric_sign_internal(), PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, power_var(), res, NumericVar::sign, and NumericVar::weight.
Referenced by numeric_to_char(), and numeric_to_number().
Datum numeric_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1077 of file numeric.c.
References alloc_var(), apply_typmod(), apply_typmod_special(), buf, ereport, errcode(), errmsg(), ERROR, free_var(), i, init_var, len, make_result(), NBASE, NUMERIC_DSCALE_MASK, NUMERIC_NAN, NUMERIC_NEG, NUMERIC_NINF, NUMERIC_PINF, NUMERIC_POS, PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_NUMERIC, pq_getmsgint(), res, trunc_var(), and value.
Datum numeric_round | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1542 of file numeric.c.
References arg, DEC_DIGITS, duplicate_numeric(), free_var(), init_var, make_result(), Max, Min, NUMERIC_DSCALE_MAX, NUMERIC_IS_SPECIAL, NUMERIC_WEIGHT_MAX, PG_GETARG_INT32, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, res, round_var(), scale, and set_var_from_num().
Referenced by cash_numeric(), numeric_to_char(), timestamp_part_common(), and timestamptz_part_common().
Datum numeric_scale | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4119 of file numeric.c.
References NUMERIC_DSCALE, NUMERIC_IS_SPECIAL, PG_GETARG_NUMERIC, PG_RETURN_INT32, and PG_RETURN_NULL.
Referenced by cash_numeric(), and numeric_cash().
Datum numeric_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1162 of file numeric.c.
References buf, i, init_var_from_num(), PG_GETARG_NUMERIC, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendint16(), and x.
Datum numeric_serialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5311 of file numeric.c.
References accum_sum_final(), AggCheckCallContext(), buf, elog, ERROR, free_var(), init_var, numericvar_serialize(), PG_GETARG_POINTER, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendint32(), and pq_sendint64().
Datum numeric_sign | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1509 of file numeric.c.
References Assert, const_minus_one, const_nan, const_one, const_zero, make_result(), NUMERIC_IS_NAN, numeric_sign_internal(), PG_GETARG_NUMERIC, and PG_RETURN_NUMERIC.
|
static |
Definition at line 1477 of file numeric.c.
References Assert, NUMERIC_IS_NAN, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, NUMERIC_NDIGITS, NUMERIC_NEG, and NUMERIC_SIGN.
Referenced by numeric_div_opt_error(), numeric_div_trunc(), numeric_log(), numeric_mod_opt_error(), numeric_mul_opt_error(), numeric_power(), and numeric_sign().
Datum numeric_smaller | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3467 of file numeric.c.
References cmp_numerics(), PG_GETARG_NUMERIC, and PG_RETURN_NUMERIC.
Datum numeric_sortsupport | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2008 of file numeric.c.
References NumericSortSupport::abbr_card, SortSupportData::abbrev_abort, SortSupportData::abbrev_converter, SortSupportData::abbrev_full_comparator, SortSupportData::abbreviate, NumericSortSupport::buf, SortSupportData::comparator, NumericSortSupport::estimating, initHyperLogLog(), NumericSortSupport::input_count, MemoryContextSwitchTo(), numeric_abbrev_abort(), numeric_abbrev_convert(), numeric_cmp_abbrev(), numeric_fast_cmp(), palloc(), PG_GETARG_POINTER, PG_RETURN_VOID, SortSupportData::ssup_cxt, SortSupportData::ssup_extra, VARATT_SHORT_MAX, and VARHDRSZ.
Datum numeric_sqrt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3673 of file numeric.c.
References arg, DEC_DIGITS, duplicate_numeric(), ereport, errcode(), errmsg(), ERROR, free_var(), init_var, init_var_from_num(), make_result(), Max, Min, NUMERIC_IS_NINF, NUMERIC_IS_SPECIAL, NUMERIC_MAX_DISPLAY_SCALE, NUMERIC_MIN_DISPLAY_SCALE, NUMERIC_MIN_SIG_DIGITS, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, res, and sqrt_var().
|
static |
Definition at line 6203 of file numeric.c.
References accum_sum_final(), cmp_var(), const_nan, const_one, const_zero, div_var(), NumericVar::dscale, free_var(), init_var, int64_to_numericvar(), make_result(), mul_var(), NA_TOTAL_COUNT, res, select_div_scale(), sqrt_var(), and sub_var().
Referenced by numeric_stddev_pop(), numeric_stddev_samp(), numeric_var_pop(), and numeric_var_samp().
Datum numeric_stddev_pop | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6338 of file numeric.c.
References numeric_stddev_internal(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_NULL, PG_RETURN_NUMERIC, and res.
Referenced by numeric_poly_stddev_pop().
Datum numeric_stddev_samp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6304 of file numeric.c.
References numeric_stddev_internal(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_NULL, PG_RETURN_NUMERIC, and res.
Referenced by numeric_poly_stddev_samp().
Datum numeric_sub | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2922 of file numeric.c.
References numeric_sub_opt_error(), PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Referenced by brin_minmax_multi_distance_numeric(), gbt_numeric_penalty(), numeric_half_rounded(), numrange_subdiff(), and pg_lsn_mii().
Definition at line 2942 of file numeric.c.
References Assert, const_nan, const_ninf, const_pinf, free_var(), init_var, init_var_from_num(), make_result(), make_result_opt_error(), NUMERIC_IS_NAN, NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, res, and sub_var().
Referenced by executeItemOptUnwrapTarget(), numeric_sub(), timestamp_part_common(), and timestamptz_part_common().
Datum numeric_sum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6160 of file numeric.c.
References accum_sum_final(), const_nan, const_ninf, const_pinf, free_var(), init_var, make_result(), NA_TOTAL_COUNT, PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_NULL, and PG_RETURN_NUMERIC.
Referenced by numeric_poly_sum().
Datum numeric_support | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1195 of file numeric.c.
References FuncExpr::args, Assert, DatumGetInt32(), exprTypmod(), SupportRequestSimplify::fcall, is_valid_numeric_typmod(), IsA, linitial, list_length(), lsecond, numeric_typmod_precision(), numeric_typmod_scale(), PG_GETARG_POINTER, PG_RETURN_POINTER, relabel_to_typmod(), and source.
Datum numeric_trim_scale | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4204 of file numeric.c.
References NumericVar::dscale, duplicate_numeric(), free_var(), get_min_scale(), init_var_from_num(), make_result(), NUMERIC_IS_SPECIAL, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Datum numeric_trunc | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1596 of file numeric.c.
References arg, DEC_DIGITS, duplicate_numeric(), free_var(), init_var, make_result(), Max, Min, NUMERIC_DSCALE_MAX, NUMERIC_IS_SPECIAL, NUMERIC_WEIGHT_MAX, PG_GETARG_INT32, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, res, scale, set_var_from_num(), and trunc_var().
Referenced by getArrayIndex().
|
inlinestatic |
Definition at line 926 of file numeric.c.
References VARHDRSZ.
Referenced by apply_typmod(), apply_typmod_special(), numeric(), numeric_maximum_size(), numeric_support(), and numerictypmodout().
|
inlinestatic |
Definition at line 941 of file numeric.c.
References VARHDRSZ.
Referenced by apply_typmod(), apply_typmod_special(), numeric(), numeric_support(), and numerictypmodout().
Datum numeric_uminus | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1419 of file numeric.c.
References NumericData::choice, duplicate_numeric(), NumericShort::n_header, NumericChoice::n_short, NUMERIC_DSCALE, NUMERIC_INF_SIGN_MASK, NUMERIC_IS_NAN, NUMERIC_IS_SHORT, NUMERIC_IS_SPECIAL, NUMERIC_NDIGITS, NUMERIC_NEG, NUMERIC_POS, NUMERIC_SHORT_SIGN_MASK, NUMERIC_SIGN, PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, and res.
Referenced by executeItemOptUnwrapTarget().
Datum numeric_uplus | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1461 of file numeric.c.
References duplicate_numeric(), PG_GETARG_NUMERIC, and PG_RETURN_NUMERIC.
Referenced by jsonb_agg_transfn_worker(), and jsonb_object_agg_transfn_worker().
Datum numeric_var_pop | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6321 of file numeric.c.
References numeric_stddev_internal(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_NULL, PG_RETURN_NUMERIC, and res.
Referenced by numeric_poly_var_pop().
Datum numeric_var_samp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6287 of file numeric.c.
References numeric_stddev_internal(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_NULL, PG_RETURN_NUMERIC, and res.
Referenced by numeric_poly_var_samp().
Datum numerictypmodin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1323 of file numeric.c.
References ArrayGetIntegerTypmods(), ereport, errcode(), errmsg(), ERROR, make_numeric_typmod(), NUMERIC_MAX_PRECISION, NUMERIC_MAX_SCALE, NUMERIC_MIN_SCALE, PG_GETARG_ARRAYTYPE_P, and PG_RETURN_INT32.
Referenced by executeItemOptUnwrapTarget().
Datum numerictypmodout | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1368 of file numeric.c.
References is_valid_numeric_typmod(), numeric_typmod_precision(), numeric_typmod_scale(), palloc(), PG_GETARG_INT32, PG_RETURN_CSTRING, res, and snprintf.
|
static |
Definition at line 7737 of file numeric.c.
References alloc_var(), buf, NumericVar::digits, NumericVar::dscale, i, len, pq_getmsgint(), NumericVar::sign, and NumericVar::weight.
Referenced by int8_avg_deserialize(), numeric_avg_deserialize(), numeric_deserialize(), and numeric_poly_deserialize().
|
static |
Definition at line 7721 of file numeric.c.
References buf, NumericVar::digits, NumericVar::dscale, i, NumericVar::ndigits, pq_sendint16(), pq_sendint32(), NumericVar::sign, and NumericVar::weight.
Referenced by int8_avg_serialize(), numeric_avg_serialize(), numeric_poly_serialize(), and numeric_serialize().
|
static |
Definition at line 8338 of file numeric.c.
References ereport, errcode(), errmsg(), ERROR, get_str_from_var(), pfree(), and val.
Referenced by exp_var(), numeric_exp(), numeric_float8_no_overflow(), and power_var().
|
static |
Definition at line 4457 of file numeric.c.
References numericvar_to_int64(), PG_INT32_MAX, PG_INT32_MIN, unlikely, and val.
Referenced by numeric_int4_opt_error(), and width_bucket_numeric().
|
static |
Definition at line 8026 of file numeric.c.
References Assert, NumericVar::digits, digits, free_var(), i, init_var, NBASE, NumericVar::ndigits, NUMERIC_NEG, PG_INT64_MIN, pg_mul_s64_overflow(), pg_sub_s64_overflow(), round_var(), set_var_from_var(), NumericVar::sign, strip_var(), unlikely, val, and NumericVar::weight.
Referenced by numeric_int2(), numeric_int8_opt_error(), numericvar_to_int32(), and power_var().
|
static |
Definition at line 8148 of file numeric.c.
References Assert, NumericVar::digits, digits, free_var(), i, init_var, NBASE, NumericVar::ndigits, NUMERIC_NEG, pg_add_u64_overflow(), pg_mul_u64_overflow(), round_var(), set_var_from_var(), NumericVar::sign, strip_var(), unlikely, val, and NumericVar::weight.
Referenced by numeric_pg_lsn().
|
static |
Definition at line 11534 of file numeric.c.
References const_one, DEC_DIGITS, NumericVar::digits, NumericVar::dscale, set_var_from_var(), and NumericVar::weight.
Referenced by get_str_from_var_sci().
|
static |
Definition at line 11167 of file numeric.c.
References cmp_var(), const_zero, NumericVar::digits, NumericVar::dscale, ereport, errcode(), errmsg(), ERROR, estimate_ln_dweight(), exp_var(), free_var(), init_var, ln_var(), Max, Min, mul_var(), NumericVar::ndigits, NUMERIC_MAX_DISPLAY_SCALE, NUMERIC_MAX_RESULT_SCALE, NUMERIC_MIN_DISPLAY_SCALE, NUMERIC_MIN_SIG_DIGITS, NUMERIC_NEG, NUMERIC_POS, numericvar_to_double_no_overflow(), numericvar_to_int64(), PG_INT32_MAX, PG_INT32_MIN, power_var_int(), set_var_from_var(), NumericVar::sign, val, NumericVar::weight, and zero_var().
Referenced by numeric_power().
|
static |
Definition at line 11329 of file numeric.c.
References const_one, DEC_DIGITS, NumericVar::digits, div_var(), NumericVar::dscale, ereport, errcode(), errmsg(), ERROR, free_var(), i, init_var, Max, Min, mul_var(), NBASE, NumericVar::ndigits, NUMERIC_MAX_DISPLAY_SCALE, NUMERIC_MIN_DISPLAY_SCALE, NUMERIC_MIN_SIG_DIGITS, NUMERIC_WEIGHT_MAX, pg_abs_s32(), round_var(), set_var_from_var(), NumericVar::weight, and zero_var().
Referenced by power_var().
Numeric random_numeric | ( | pg_prng_state * | state, |
Numeric | rmin, | ||
Numeric | rmax | ||
) |
Definition at line 4225 of file numeric.c.
References ereport, errcode(), errmsg(), ERROR, free_var(), init_var, init_var_from_num(), make_result(), NUMERIC_IS_NAN, NUMERIC_IS_SPECIAL, random_var(), and res.
Referenced by numeric_random().
|
static |
Definition at line 11559 of file numeric.c.
References add_var(), alloc_var(), cmp_var(), DEC_DIGITS, NumericVar::digits, NumericVar::dscale, ereport, errcode(), errmsg(), ERROR, free_var(), i, init_var, Max, NBASE, NumericVar::ndigits, NUMERIC_NEG, NUMERIC_POS, pg_prng_uint64_range(), set_var_from_var(), NumericVar::sign, strip_var(), sub_var(), NumericVar::weight, and while().
Referenced by random_numeric().
|
static |
Definition at line 11987 of file numeric.c.
References Assert, NumericVar::buf, DEC_DIGITS, NumericVar::digits, digits, NumericVar::dscale, HALF_NBASE, NBASE, NumericVar::ndigits, NUMERIC_POS, round_powers, NumericVar::sign, and NumericVar::weight.
Referenced by apply_typmod(), div_var(), div_var_int(), exp_var(), mul_var(), numeric_mul_opt_error(), numeric_round(), numericvar_to_int64(), numericvar_to_uint64(), power_var_int(), and sqrt_var().
|
static |
Definition at line 10013 of file numeric.c.
References DEC_DIGITS, NumericVar::digits, NumericVar::dscale, i, Max, Min, NumericVar::ndigits, NUMERIC_MAX_DISPLAY_SCALE, NUMERIC_MIN_DISPLAY_SCALE, NUMERIC_MIN_SIG_DIGITS, and NumericVar::weight.
Referenced by numeric_div_opt_error(), and numeric_stddev_internal().
|
static |
Definition at line 7239 of file numeric.c.
References add_var(), generate_unaccent_rules::dest, ereturn, errcode(), errmsg(), free_var(), init_var, int64_to_numericvar(), mul_var(), NUMERIC_WEIGHT_MAX, PG_INT64_MAX, sign, str, unlikely, xdigit_value(), and zero_var().
Referenced by numeric_in().
|
static |
Definition at line 7417 of file numeric.c.
References alloc_var(), generate_unaccent_rules::dest, NUMERIC_DIGITS, NUMERIC_DSCALE, NUMERIC_NDIGITS, NUMERIC_SIGN, and NUMERIC_WEIGHT.
Referenced by generate_series_step_numeric(), numeric(), numeric_round(), and numeric_trunc().
|
static |
Definition at line 7009 of file numeric.c.
References alloc_var(), DEC_DIGITS, generate_unaccent_rules::dest, digits, ereturn, errcode(), errmsg(), i, NUMERIC_NEG, NUMERIC_POS, palloc(), pfree(), PG_INT32_MAX, sign, str, and strip_var().
Referenced by float4_numeric(), float8_numeric(), and numeric_in().
|
static |
Definition at line 7465 of file numeric.c.
References generate_unaccent_rules::dest, digitbuf_alloc, digitbuf_free, and value.
Referenced by accum_sum_final(), ceil_var(), div_mod_var(), exp_var(), floor_var(), gcd_var(), generate_series_step_numeric(), ln_var(), numeric_lcm(), numericvar_to_int64(), numericvar_to_uint64(), power_ten_int(), power_var(), power_var_int(), random_var(), sqrt_var(), and width_bucket_numeric().
|
static |
Definition at line 10298 of file numeric.c.
References a1, add_var(), alloc_var(), arg, Assert, b, cmp_var(), const_one, const_zero, DEC_DIGITS, NumericVar::digits, div_mod_var(), NumericVar::dscale, ereport, errcode(), errmsg(), ERROR, free_var(), i, init_var, int64_to_numericvar(), Max, Min, mul_var(), NBASE, NUMERIC_NEG, NUMERIC_POS, round_var(), set_var_from_var(), NumericVar::sign, stat, strip_var(), sub_var(), NumericVar::weight, and zero_var().
Referenced by ln_var(), numeric_sqrt(), and numeric_stddev_internal().
|
static |
Definition at line 12155 of file numeric.c.
References NumericVar::digits, digits, NumericVar::ndigits, NUMERIC_POS, NumericVar::sign, and NumericVar::weight.
Referenced by accum_sum_final(), add_abs(), div_var(), div_var_int(), mul_var(), mul_var_short(), numericvar_to_int64(), numericvar_to_uint64(), random_var(), set_var_from_str(), sqrt_var(), and sub_abs().
|
static |
Definition at line 11905 of file numeric.c.
References Assert, NumericVar::buf, digitbuf_alloc, digitbuf_free, NumericVar::digits, NumericVar::dscale, i, Max, NBASE, NumericVar::ndigits, strip_var(), and NumericVar::weight.
|
static |
Definition at line 8545 of file numeric.c.
References add_abs(), cmp_abs(), NumericVar::dscale, Max, NUMERIC_NEG, NUMERIC_POS, NumericVar::sign, sub_abs(), and zero_var().
Referenced by compute_bucket(), div_mod_var(), estimate_ln_dweight(), floor_var(), in_range_numeric_numeric(), ln_var(), mod_var(), numeric_stddev_internal(), numeric_sub_opt_error(), random_var(), and sqrt_var().
|
static |
Definition at line 12093 of file numeric.c.
References DEC_DIGITS, NumericVar::digits, digits, NumericVar::dscale, NumericVar::ndigits, NUMERIC_POS, round_powers, NumericVar::sign, and NumericVar::weight.
Referenced by ceil_var(), div_var(), div_var_int(), floor_var(), numeric_recv(), and numeric_trunc().
Datum width_bucket_numeric | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1845 of file numeric.c.
References add_var(), cmp_numerics(), compute_bucket(), const_one, const_zero, ereport, errcode(), errmsg(), ERROR, free_var(), init_var, int64_to_numericvar(), NUMERIC_IS_INF, NUMERIC_IS_NAN, NUMERIC_IS_SPECIAL, numericvar_to_int32(), PG_GETARG_INT32, PG_GETARG_NUMERIC, PG_RETURN_INT32, and set_var_from_var().
|
inlinestatic |
|
static |
Definition at line 6982 of file numeric.c.
References NumericVar::buf, digitbuf_free, NumericVar::digits, NumericVar::ndigits, NUMERIC_POS, NumericVar::sign, and NumericVar::weight.
Referenced by add_var(), div_var(), div_var_int(), exp_var(), mul_var(), power_var(), power_var_int(), set_var_from_non_decimal_integer_str(), sqrt_var(), and sub_var().
|
static |
Definition at line 431 of file numeric.c.
Referenced by numeric_power(), and numeric_sign().
|
static |
Definition at line 458 of file numeric.c.
Referenced by float4_numeric(), float8_numeric(), numeric_add_opt_error(), numeric_avg(), numeric_div_opt_error(), numeric_div_trunc(), numeric_gcd(), numeric_in(), numeric_lcm(), numeric_log(), numeric_mod_opt_error(), numeric_mul_opt_error(), numeric_power(), numeric_sign(), numeric_stddev_internal(), numeric_sub_opt_error(), and numeric_sum().
|
static |
Definition at line 464 of file numeric.c.
Referenced by float4_numeric(), float8_numeric(), numeric_add_opt_error(), numeric_avg(), numeric_div_opt_error(), numeric_div_trunc(), numeric_in(), numeric_mul_opt_error(), numeric_power(), numeric_sub_opt_error(), and numeric_sum().
|
static |
Definition at line 428 of file numeric.c.
Referenced by ceil_var(), compute_bucket(), div_mod_var(), estimate_ln_dweight(), exp_var(), floor_var(), generate_series_step_numeric(), ln_var(), numeric_fac(), numeric_inc(), numeric_power(), numeric_sign(), numeric_stddev_internal(), power_ten_int(), power_var_int(), sqrt_var(), and width_bucket_numeric().
|
static |
|
static |
Definition at line 455 of file numeric.c.
Referenced by estimate_ln_dweight(), and ln_var().
|
static |
|
static |
Definition at line 461 of file numeric.c.
Referenced by float4_numeric(), float8_numeric(), numeric_add_opt_error(), numeric_avg(), numeric_div_opt_error(), numeric_div_trunc(), numeric_in(), numeric_log(), numeric_mul_opt_error(), numeric_power(), numeric_sub_opt_error(), and numeric_sum().
|
static |
|
static |
|
static |
Definition at line 424 of file numeric.c.
Referenced by accum_sum_final(), generate_series_step_numeric(), ln_var(), numeric_div_opt_error(), numeric_div_trunc(), numeric_exp(), numeric_lcm(), numeric_log(), numeric_power(), numeric_sign(), numeric_stddev_internal(), power_var(), sqrt_var(), and width_bucket_numeric().
|
static |
|
static |
Definition at line 445 of file numeric.c.
Referenced by estimate_ln_dweight(), and ln_var().
|
static |
|
static |
Definition at line 468 of file numeric.c.
Referenced by round_var(), and trunc_var().