|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <ctype.h>#include <unistd.h>#include <math.h>#include <float.h>#include <limits.h>#include "catalog/pg_type.h"#include "common/int.h"#include "mb/pg_wchar.h"#include "nodes/miscnodes.h"#include "parser/scansup.h"#include "utils/builtins.h"#include "utils/date.h"#include "utils/datetime.h"#include "utils/formatting.h"#include "utils/memutils.h"#include "utils/numeric.h"#include "utils/pg_locale.h"#include "varatt.h"
Go to the source code of this file.
Data Structures | |
| struct | KeySuffix |
| struct | KeyWord |
| struct | FormatNode |
| struct | NUMDesc |
| struct | DCHCacheEntry |
| struct | NUMCacheEntry |
| struct | TmFromChar |
| struct | fmt_tz |
| struct | fmt_tm |
| struct | TmToChar |
| struct | NUMProc |
Typedefs | |
| typedef struct TmToChar | TmToChar |
| typedef struct NUMProc | NUMProc |
| #define A_D_STR "A.D." |
Definition at line 187 of file formatting.c.
| #define a_d_STR "a.d." |
Definition at line 188 of file formatting.c.
| #define A_M_STR "A.M." |
Definition at line 213 of file formatting.c.
| #define a_m_STR "a.m." |
Definition at line 214 of file formatting.c.
| #define AD_STR "AD" |
Definition at line 189 of file formatting.c.
| #define ad_STR "ad" |
Definition at line 190 of file formatting.c.
| #define ADJUST_YEAR | ( | year, | |
| is_interval | |||
| ) | ((is_interval) ? (year) : ((year) <= 0 ? -((year) - 1) : (year))) |
Definition at line 185 of file formatting.c.
| #define AM_STR "AM" |
Definition at line 215 of file formatting.c.
| #define am_STR "am" |
Definition at line 216 of file formatting.c.
Definition at line 1063 of file formatting.c.
| #define B_C_STR "B.C." |
Definition at line 192 of file formatting.c.
| #define b_c_STR "b.c." |
Definition at line 193 of file formatting.c.
| #define BC_STR "BC" |
Definition at line 194 of file formatting.c.
| #define bc_STR "bc" |
Definition at line 195 of file formatting.c.
| #define DCH_CACHE_ENTRIES 20 |
Definition at line 379 of file formatting.c.
Definition at line 369 of file formatting.c.
| #define DCH_CACHE_SIZE ((2048 - DCH_CACHE_OVERHEAD) / (sizeof(FormatNode) + sizeof(char)) - 1) |
Definition at line 374 of file formatting.c.
| #define DCH_DATED 0x01 |
Definition at line 1053 of file formatting.c.
Definition at line 103 of file formatting.c.
| #define DCH_SUFFIX_FM 0x01 |
Definition at line 550 of file formatting.c.
| #define DCH_SUFFIX_SP 0x08 |
Definition at line 553 of file formatting.c.
| #define DCH_SUFFIX_TH 0x02 |
Definition at line 551 of file formatting.c.
| #define DCH_SUFFIX_th 0x04 |
Definition at line 552 of file formatting.c.
| #define DCH_SUFFIX_TM 0x10 |
Definition at line 554 of file formatting.c.
| #define DCH_TIMED 0x02 |
Definition at line 1054 of file formatting.c.
| #define DCH_ZONED 0x04 |
Definition at line 1055 of file formatting.c.
Definition at line 468 of file formatting.c.
Definition at line 467 of file formatting.c.
| #define INVALID_FOR_INTERVAL |
| #define IS_BLANK | ( | _f | ) | ((_f)->flag & NUM_F_BLANK) |
Definition at line 342 of file formatting.c.
| #define IS_BRACKET | ( | _f | ) | ((_f)->flag & NUM_F_BRACKET) |
Definition at line 344 of file formatting.c.
| #define IS_DECIMAL | ( | _f | ) | ((_f)->flag & NUM_F_DECIMAL) |
Definition at line 339 of file formatting.c.
| #define IS_EEEE | ( | _f | ) | ((_f)->flag & NUM_F_EEEE) |
Definition at line 350 of file formatting.c.
| #define IS_FILLMODE | ( | _f | ) | ((_f)->flag & NUM_F_FILLMODE) |
Definition at line 343 of file formatting.c.
| #define IS_LDECIMAL | ( | _f | ) | ((_f)->flag & NUM_F_LDECIMAL) |
Definition at line 340 of file formatting.c.
| #define IS_LSIGN | ( | _f | ) | ((_f)->flag & NUM_F_LSIGN) |
Definition at line 346 of file formatting.c.
| #define IS_MINUS | ( | _f | ) | ((_f)->flag & NUM_F_MINUS) |
Definition at line 345 of file formatting.c.
| #define IS_MULTI | ( | _f | ) | ((_f)->flag & NUM_F_MULTI) |
Definition at line 349 of file formatting.c.
| #define IS_PLUS | ( | _f | ) | ((_f)->flag & NUM_F_PLUS) |
Definition at line 347 of file formatting.c.
Definition at line 5525 of file formatting.c.
| #define IS_ROMAN | ( | _f | ) | ((_f)->flag & NUM_F_ROMAN) |
Definition at line 348 of file formatting.c.
| #define IS_ZERO | ( | _f | ) | ((_f)->flag & NUM_F_ZERO) |
Definition at line 341 of file formatting.c.
Definition at line 98 of file formatting.c.
| #define KeyWord_INDEX_SIZE ('~' - ' ') |
Definition at line 97 of file formatting.c.
| #define MAX_ROMAN_LEN 15 |
Definition at line 278 of file formatting.c.
| #define NUM_CACHE_ENTRIES 20 |
Definition at line 380 of file formatting.c.
Definition at line 371 of file formatting.c.
| #define NUM_CACHE_SIZE ((1024 - NUM_CACHE_OVERHEAD) / (sizeof(FormatNode) + sizeof(char)) - 1) |
Definition at line 376 of file formatting.c.
| #define NUM_F_BLANK (1 << 4) |
Definition at line 324 of file formatting.c.
| #define NUM_F_BRACKET (1 << 7) |
Definition at line 327 of file formatting.c.
| #define NUM_F_DECIMAL (1 << 1) |
Definition at line 321 of file formatting.c.
| #define NUM_F_EEEE (1 << 14) |
Definition at line 334 of file formatting.c.
| #define NUM_F_FILLMODE (1 << 5) |
Definition at line 325 of file formatting.c.
| #define NUM_F_LDECIMAL (1 << 2) |
Definition at line 322 of file formatting.c.
| #define NUM_F_LSIGN (1 << 6) |
Definition at line 326 of file formatting.c.
| #define NUM_F_MINUS (1 << 8) |
Definition at line 328 of file formatting.c.
| #define NUM_F_MINUS_POST (1 << 13) |
Definition at line 333 of file formatting.c.
| #define NUM_F_MULTI (1 << 11) |
Definition at line 331 of file formatting.c.
| #define NUM_F_PLUS (1 << 9) |
Definition at line 329 of file formatting.c.
| #define NUM_F_PLUS_POST (1 << 12) |
Definition at line 332 of file formatting.c.
| #define NUM_F_ROMAN (1 << 10) |
Definition at line 330 of file formatting.c.
| #define NUM_F_ZERO (1 << 3) |
Definition at line 323 of file formatting.c.
Definition at line 91 of file formatting.c.
Definition at line 104 of file formatting.c.
| #define NUM_TOCHAR_finish |
Definition at line 6217 of file formatting.c.
| #define NUM_TOCHAR_prepare |
Definition at line 6205 of file formatting.c.
Definition at line 1062 of file formatting.c.
| #define P_M_STR "P.M." |
Definition at line 218 of file formatting.c.
| #define p_m_STR "p.m." |
Definition at line 219 of file formatting.c.
| #define PM_STR "PM" |
Definition at line 220 of file formatting.c.
| #define pm_STR "pm" |
Definition at line 221 of file formatting.c.
| #define ROMAN_VAL | ( | r | ) |
Definition at line 266 of file formatting.c.
Definition at line 1991 of file formatting.c.
Definition at line 92 of file formatting.c.
| #define TM_SUFFIX_LEN 2 |
Definition at line 599 of file formatting.c.
Definition at line 500 of file formatting.c.
Definition at line 499 of file formatting.c.
Definition at line 640 of file formatting.c.
| Enumerator | |
|---|---|
| NODE_TYPE_END | |
| NODE_TYPE_ACTION | |
| NODE_TYPE_CHAR | |
| NODE_TYPE_SEPARATOR | |
| NODE_TYPE_SPACE | |
Definition at line 147 of file formatting.c.
| Enumerator | |
|---|---|
| FROM_CHAR_DATE_NONE | |
| FROM_CHAR_DATE_GREGORIAN | |
| FROM_CHAR_DATE_ISOWEEK | |
Definition at line 131 of file formatting.c.
| Enumerator | |
|---|---|
| SUFFTYPE_PREFIX | |
| SUFFTYPE_POSTFIX | |
Definition at line 111 of file formatting.c.
Definition at line 759 of file formatting.c.
| Enumerator | |
|---|---|
| NUM_LSIGN_PRE | |
| NUM_LSIGN_POST | |
| NUM_LSIGN_NONE | |
Definition at line 295 of file formatting.c.
| Enumerator | |
|---|---|
| TH_UPPER | |
| TH_LOWER | |
Definition at line 289 of file formatting.c.
Definition at line 2069 of file formatting.c.
Referenced by DCH_from_char().
Definition at line 1924 of file formatting.c.
References fb(), pg_ascii_tolower(), pg_ascii_toupper(), and pnstrdup().
Referenced by str_initcap().
Definition at line 1880 of file formatting.c.
References fb(), pg_ascii_tolower(), and pnstrdup().
Referenced by asc_tolower_z(), str_casefold(), and str_tolower().
Definition at line 1972 of file formatting.c.
References asc_tolower(), and fb().
Referenced by DCH_to_char(), and NUM_processor().
Definition at line 1902 of file formatting.c.
References fb(), pg_ascii_toupper(), and pnstrdup().
Referenced by asc_toupper_z(), and str_toupper().
Definition at line 1978 of file formatting.c.
References asc_toupper(), and fb().
Referenced by DCH_to_char().
Definition at line 4317 of file formatting.c.
References DCH_cache_fetch(), DCH_CACHE_SIZE, DCH_datetime_type(), DCH_FLAG, DCH_index, DCH_keywords, DCH_suff, DCH_ZONED, fb(), format, palloc(), parse_format(), and pfree().
Referenced by jspIsMutableWalker().
|
static |
Definition at line 3888 of file formatting.c.
References collid, cstring_to_text(), DCH_cache_fetch(), DCH_CACHE_SIZE, DCH_FLAG, DCH_index, DCH_keywords, DCH_MAX_ITEM_SIZ, DCH_suff, DCH_to_char(), fb(), format, palloc(), parse_format(), pfree(), and text_to_cstring().
Referenced by interval_to_char(), timestamp_to_char(), and timestamptz_to_char().
|
static |
Definition at line 3861 of file formatting.c.
References DCH_cache_getnew(), DCH_cache_search(), DCH_FLAG, DCH_index, DCH_keywords, DCH_suff, fb(), parse_format(), STD_FLAG, and str.
Referenced by datetime_format_has_tz(), datetime_to_char_body(), and do_to_timestamp().
|
static |
Definition at line 3780 of file formatting.c.
References Assert, DCH_CACHE_ENTRIES, DCH_CACHE_SIZE, DCH_prevent_counter_overflow(), DCHCache, DCHCounter, elog, fb(), i, MemoryContextAllocZero(), n_DCHCache, str, strlcpy(), TopMemoryContext, and DCHCacheEntry::valid.
Referenced by DCH_cache_fetch().
|
static |
Definition at line 3840 of file formatting.c.
References DCHCacheEntry::age, DCH_prevent_counter_overflow(), DCHCache, DCHCounter, fb(), i, n_DCHCache, and str.
Referenced by DCH_cache_fetch().
|
static |
Definition at line 3684 of file formatting.c.
References DCH_A_D, DCH_a_d, DCH_A_M, DCH_a_m, DCH_AD, DCH_ad, DCH_AM, DCH_am, DCH_B_C, DCH_b_c, DCH_BC, DCH_bc, DCH_CC, DCH_D, DCH_DATED, DCH_DAY, DCH_Day, DCH_day, DCH_DD, DCH_DDD, DCH_DY, DCH_Dy, DCH_dy, DCH_FF1, DCH_FF2, DCH_FF3, DCH_FF4, DCH_FF5, DCH_FF6, DCH_FX, DCH_HH, DCH_HH12, DCH_HH24, DCH_I, DCH_ID, DCH_IDDD, DCH_IY, DCH_IYY, DCH_IYYY, DCH_J, DCH_MI, DCH_MM, DCH_MON, DCH_Mon, DCH_mon, DCH_MONTH, DCH_Month, DCH_month, DCH_MS, DCH_OF, DCH_P_M, DCH_p_m, DCH_PM, DCH_pm, DCH_Q, DCH_RM, DCH_rm, DCH_SS, DCH_SSSS, DCH_TIMED, DCH_TZ, DCH_tz, DCH_TZH, DCH_TZM, DCH_US, DCH_W, DCH_WW, DCH_Y, DCH_Y_YYY, DCH_YY, DCH_YYY, DCH_YYYY, DCH_ZONED, KeyWord::id, FormatNode::key, NODE_TYPE_ACTION, NODE_TYPE_END, and FormatNode::type.
Referenced by datetime_format_has_tz(), and do_to_timestamp().
|
static |
Definition at line 3114 of file formatting.c.
References TmFromChar::abbrev, adbc_strings, adbc_strings_long, adjust_partial_year_to_2020(), ampm_strings, ampm_strings_long, Assert, TmFromChar::bc, cache_locale_time(), TmFromChar::cc, FormatNode::character, TmFromChar::clock_12_hour, collid, TmFromChar::d, KeyWord::date_mode, days, days_short, DCH_A_D, DCH_a_d, DCH_A_M, DCH_a_m, DCH_AD, DCH_ad, DCH_AM, DCH_am, DCH_B_C, DCH_b_c, DCH_BC, DCH_bc, DCH_CC, DCH_D, DCH_DAY, DCH_Day, DCH_day, DCH_DD, DCH_DDD, DCH_DY, DCH_Dy, DCH_dy, DCH_FF1, DCH_FF2, DCH_FF3, DCH_FF4, DCH_FF5, DCH_FF6, DCH_FX, DCH_HH, DCH_HH12, DCH_HH24, DCH_I, DCH_ID, DCH_IDDD, DCH_IW, DCH_IY, DCH_IYY, DCH_IYYY, DCH_J, DCH_MI, DCH_MM, DCH_MON, DCH_Mon, DCH_mon, DCH_MONTH, DCH_Month, DCH_month, DCH_MS, DCH_OF, DCH_P_M, DCH_p_m, DCH_PM, DCH_pm, DCH_Q, DCH_RM, DCH_rm, DCH_SS, DCH_SSSS, DCH_TZ, DCH_tz, DCH_TZH, DCH_TZM, DCH_US, DCH_W, DCH_WW, DCH_Y, DCH_Y_YYY, DCH_YY, DCH_YYY, DCH_YYYY, TmFromChar::dd, TmFromChar::ddd, DecodeTimezoneAbbrevPrefix(), ereturn, errcode(), errdetail(), errmsg(), fb(), TmFromChar::ff, from_char_parse_int(), from_char_parse_int_len(), from_char_seq_search(), from_char_set_int(), from_char_set_mode(), TmFromChar::gmtoffset, TmFromChar::has_tz, TmFromChar::hh, KeyWord::id, InvalidOid, is_separator_char(), IS_SUFFIX_TM(), TmFromChar::j, FormatNode::key, len, localized_abbrev_days, localized_abbrev_months, localized_full_days, localized_full_months, TmFromChar::mi, TmFromChar::mm, months, months_full, MONTHS_PER_YEAR, TmFromChar::ms, KeyWord::name, NODE_TYPE_ACTION, NODE_TYPE_CHAR, NODE_TYPE_END, NODE_TYPE_SEPARATOR, NODE_TYPE_SPACE, pg_add_s32_overflow(), pg_mblen(), pg_mul_s32_overflow(), TmFromChar::pm, pnstrdup(), rm_months_lower, SKIP_THth, TmFromChar::ss, TmFromChar::ssss, FormatNode::suffix, FormatNode::type, TmFromChar::tzh, TmFromChar::tzm, TmFromChar::tzp, TmFromChar::tzsign, TmFromChar::us, value, TmFromChar::w, TmFromChar::ww, TmFromChar::year, and TmFromChar::yysz.
Referenced by do_to_timestamp().
Definition at line 3670 of file formatting.c.
References DCHCache, DCHCounter, fb(), i, and n_DCHCache.
Referenced by DCH_cache_getnew(), and DCH_cache_search().
|
static |
Definition at line 2468 of file formatting.c.
References A_D_STR, a_d_STR, A_M_STR, a_m_STR, AD_STR, ad_STR, ADJUST_YEAR, AM_STR, am_STR, asc_tolower_z(), asc_toupper_z(), B_C_STR, b_c_STR, BC_STR, bc_STR, cache_locale_time(), FormatNode::character, collid, date2isoweek(), date2isoyear(), date2isoyearday(), date2j(), days, days_short, DCH_A_D, DCH_a_d, DCH_A_M, DCH_a_m, DCH_AD, DCH_ad, DCH_AM, DCH_am, DCH_B_C, DCH_b_c, DCH_BC, DCH_bc, DCH_CC, DCH_D, DCH_DAY, DCH_Day, DCH_day, DCH_DD, DCH_DDD, DCH_DY, DCH_Dy, DCH_dy, DCH_FF1, DCH_FF2, DCH_FF3, DCH_FF4, DCH_FF5, DCH_FF6, DCH_HH, DCH_HH12, DCH_HH24, DCH_I, DCH_ID, DCH_IDDD, DCH_IW, DCH_IY, DCH_IYY, DCH_IYYY, DCH_J, DCH_MAX_ITEM_SIZ, DCH_MI, DCH_MM, DCH_MON, DCH_Mon, DCH_mon, DCH_MONTH, DCH_Month, DCH_month, DCH_MS, DCH_OF, DCH_P_M, DCH_p_m, DCH_PM, DCH_pm, DCH_Q, DCH_RM, DCH_rm, DCH_SS, DCH_SSSS, DCH_to_char_fsec, DCH_TZ, DCH_tz, DCH_TZH, DCH_TZM, DCH_US, DCH_W, DCH_WW, DCH_Y, DCH_Y_YYY, DCH_YY, DCH_YYY, DCH_YYYY, ereport, errcode(), errmsg(), ERROR, fb(), TmToChar::fsec, HOURS_PER_DAY, i, KeyWord::id, INVALID_FOR_INTERVAL, IS_SUFFIX_FM(), IS_SUFFIX_THth(), IS_SUFFIX_TM(), FormatNode::key, KeyWord::len, localized_abbrev_days, localized_abbrev_months, localized_full_days, localized_full_months, months, months_full, MONTHS_PER_YEAR, NODE_TYPE_ACTION, NODE_TYPE_END, P_M_STR, p_m_STR, pfree(), PM_STR, pm_STR, rm_months_lower, rm_months_upper, SECS_PER_HOUR, SECS_PER_MINUTE, sprintf, str, str_initcap_z(), str_numth(), str_tolower_z(), str_toupper_z(), FormatNode::suffix, SUFFIX_TH_TYPE(), TmToChar::tm, tm, pg_tm::tm_gmtoff, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, TM_SUFFIX_LEN, pg_tm::tm_wday, pg_tm::tm_yday, pg_tm::tm_year, tmtcTzn, and FormatNode::type.
Referenced by datetime_to_char_body().
|
static |
Definition at line 4380 of file formatting.c.
References Assert, collid, DateTimeParseError(), DAY, DCH_cache_fetch(), DCH_CACHE_SIZE, DCH_datetime_type(), DCH_FLAG, DCH_from_char(), DCH_index, DCH_keywords, DCH_suff, DEBUG_TM, DEBUG_TMFC, DetermineTimeZoneAbbrevOffset(), DTERR_FIELD_OVERFLOW, DTERR_TZDISP_OVERFLOW, DTK_DATE_M, DTK_M, errcode(), errhint(), errmsg(), errsave, fb(), format, FROM_CHAR_DATE_ISOWEEK, fmt_tz::gmtoffset, fmt_tz::has_tz, HOURS_PER_DAY, i, INT64CONST, isleap, isoweek2date(), isoweek2j(), isoweekdate2date(), j2date(), MAX_TZDISP_HOUR, MINS_PER_HOUR, MONTH, MONTHS_PER_YEAR, palloc(), parse_format(), pfree(), pg_add_s32_overflow(), pg_mul_s32_overflow(), pg_sub_s32_overflow(), SECS_PER_HOUR, SECS_PER_MINUTE, SOFT_ERROR_OCCURRED, STD_FLAG, text_to_cstring(), tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, USECS_PER_SEC, ValidateDate(), VARSIZE_ANY_EXHDR(), x, y, YEAR, and ZERO_tm.
Referenced by parse_datetime(), to_date(), and to_timestamp().
Definition at line 4815 of file formatting.c.
Referenced by float4_to_char(), float8_to_char(), int4_to_char(), int8_to_char(), int_to_roman(), and numeric_to_char().
| Datum float4_to_char | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6624 of file formatting.c.
References fb(), fill_str(), FLOAT4_FITS_IN_INT32, format, int_to_roman(), IS_EEEE, IS_MULTI, IS_ROMAN, NUMDesc::multi, NUM_TOCHAR_finish, NUM_TOCHAR_prepare, palloc(), PG_GETARG_FLOAT4, PG_GETARG_TEXT_PP, PG_INT32_MAX, PG_RETURN_TEXT_P, NUMDesc::post, NUMDesc::pre, psprintf(), sign, val, and value.
| Datum float8_to_char | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6736 of file formatting.c.
References fb(), fill_str(), FLOAT8_FITS_IN_INT32, format, int_to_roman(), IS_EEEE, IS_MULTI, IS_ROMAN, NUMDesc::multi, NUM_TOCHAR_finish, NUM_TOCHAR_prepare, palloc(), PG_GETARG_FLOAT8, PG_GETARG_TEXT_PP, PG_INT32_MAX, PG_RETURN_TEXT_P, NUMDesc::post, NUMDesc::pre, psprintf(), sign, val, and value.
|
static |
Definition at line 2271 of file formatting.c.
References from_char_parse_int_len(), FormatNode::key, and KeyWord::len.
Referenced by DCH_from_char().
|
static |
Definition at line 2176 of file formatting.c.
References Assert, DCH_MAX_ITEM_SIZ, ereturn, errcode(), errdetail(), errhint(), errmsg(), fb(), from_char_set_int(), init, is_next_separator(), IS_SUFFIX_FM(), FormatNode::key, len, KeyWord::name, strlcpy(), strspace_len(), and FormatNode::suffix.
Referenced by DCH_from_char(), and from_char_parse_int().
|
static |
Definition at line 2425 of file formatting.c.
References collid, ereturn, errcode(), errdetail(), errmsg(), fb(), FormatNode::key, len, KeyWord::name, pstrdup(), scanner_isspace(), seq_search_ascii(), and seq_search_localized().
Referenced by DCH_from_char().
|
static |
Definition at line 2141 of file formatting.c.
References ereturn, errcode(), errdetail(), errmsg(), fb(), FormatNode::key, KeyWord::name, and value.
Referenced by DCH_from_char(), and from_char_parse_int_len().
|
static |
Definition at line 2115 of file formatting.c.
References ereturn, errcode(), errhint(), errmsg(), fb(), FROM_CHAR_DATE_NONE, and mode.
Referenced by DCH_from_char().
Definition at line 5294 of file formatting.c.
Referenced by NUM_processor().
Definition at line 1555 of file formatting.c.
References Assert, ereport, errcode(), errmsg(), ERROR, fb(), len, numTH, numth, TH_UPPER, and type.
Referenced by NUM_processor(), and str_numth().
|
static |
Definition at line 1134 of file formatting.c.
References fb(), KeyWord_INDEX_FILTER, KeyWord::len, KeyWord::name, and str.
Referenced by parse_format().
| Datum int4_to_char | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6420 of file formatting.c.
References DatumGetCString(), DirectFunctionCall1, fb(), fill_str(), format, Int32GetDatum(), int4out(), int_to_roman(), IS_EEEE, IS_MULTI, IS_ROMAN, NUMDesc::multi, NUM_TOCHAR_finish, NUM_TOCHAR_prepare, palloc(), PG_GETARG_INT32, PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, NUMDesc::post, NUMDesc::pre, psprintf(), sign, val, and value.
| Datum int8_to_char | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6513 of file formatting.c.
References DatumGetCString(), DatumGetInt64(), DirectFunctionCall1, DirectFunctionCall2, dtoi8(), fb(), fill_str(), Float8GetDatum(), format, int64_to_numeric(), Int64GetDatum(), int8mul(), int8out(), int_to_roman(), IS_EEEE, IS_MULTI, IS_ROMAN, NUMDesc::multi, NUM_TOCHAR_finish, NUM_TOCHAR_prepare, numeric_out_sci(), palloc(), PG_GETARG_INT64, PG_GETARG_TEXT_PP, PG_INT32_MAX, PG_INT32_MIN, PG_RETURN_TEXT_P, NUMDesc::post, NUMDesc::pre, sign, and value.
Definition at line 5005 of file formatting.c.
References Assert, fb(), fill_str(), len, MAX_ROMAN_LEN, palloc(), rm1, rm10, rm100, and snprintf.
Referenced by float4_to_char(), float8_to_char(), int4_to_char(), int8_to_char(), and numeric_to_char().
| Datum interval_to_char | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4031 of file formatting.c.
References datetime_to_char_body(), DAYS_PER_MONTH, fb(), interval2itm(), INTERVAL_NOT_FINITE, MONTHS_PER_YEAR, PG_GET_COLLATION, PG_GETARG_INTERVAL_P, PG_GETARG_TEXT_PP, PG_RETURN_NULL, PG_RETURN_TEXT_P, tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_yday, pg_tm::tm_year, tmtcTm, VARSIZE_ANY_EXHDR(), and ZERO_tmtc.
|
static |
Definition at line 2036 of file formatting.c.
References FormatNode::character, fb(), KeyWord::is_digit, IS_SUFFIX_THth(), FormatNode::key, NODE_TYPE_ACTION, NODE_TYPE_END, FormatNode::suffix, and FormatNode::type.
Referenced by from_char_parse_int_len().
Definition at line 1172 of file formatting.c.
References str.
Referenced by DCH_from_char(), and parse_format().
Definition at line 585 of file formatting.c.
References DCH_SUFFIX_FM, and fb().
Referenced by DCH_to_char(), and from_char_parse_int_len().
Definition at line 560 of file formatting.c.
References DCH_SUFFIX_TH, and fb().
Referenced by IS_SUFFIX_THth().
Definition at line 566 of file formatting.c.
References DCH_SUFFIX_th, and fb().
Referenced by IS_SUFFIX_THth().
Definition at line 572 of file formatting.c.
References fb(), IS_SUFFIX_TH(), and IS_SUFFIX_th().
Referenced by DCH_to_char(), and is_next_separator().
Definition at line 591 of file formatting.c.
References DCH_SUFFIX_TM, and fb().
Referenced by DCH_from_char(), and DCH_to_char().
|
static |
Definition at line 4942 of file formatting.c.
References fb(), NUMDesc::flag, format, len, NUMDesc::lsign, NUMDesc::multi, NUMDesc::need_locale, NUM_cache_fetch(), NUM_CACHE_SIZE, NUM_FLAG, NUM_index, NUM_keywords, palloc(), parse_format(), pfree(), NUMDesc::post, NUMDesc::pre, NUMDesc::pre_lsign_num, str, text_to_cstring(), NUMDesc::zero_end, and NUMDesc::zero_start.
Referenced by numeric_to_number().
|
static |
Definition at line 4915 of file formatting.c.
References fb(), NUM_cache_getnew(), NUM_cache_search(), NUM_FLAG, NUM_index, NUM_keywords, parse_format(), and str.
Referenced by NUM_cache().
|
static |
Definition at line 4835 of file formatting.c.
References Assert, elog, fb(), i, MemoryContextAllocZero(), n_NUMCache, NUM_CACHE_ENTRIES, NUM_CACHE_SIZE, NUM_prevent_counter_overflow(), NUMCache, NUMCounter, str, strlcpy(), TopMemoryContext, and NUMCacheEntry::valid.
Referenced by NUM_cache_fetch().
|
static |
Definition at line 4894 of file formatting.c.
References NUMCacheEntry::age, fb(), i, n_NUMCache, NUM_prevent_counter_overflow(), NUMCache, NUMCounter, and str.
Referenced by NUM_cache_fetch().
Definition at line 5725 of file formatting.c.
References fb(), OVERLOAD_TEST, and pg_mblen().
Referenced by NUM_processor().
Definition at line 5321 of file formatting.c.
References AMOUNT_TEST, elog, fb(), IS_BRACKET, IS_DECIMAL, IS_LSIGN, IS_MINUS, IS_PLUS, NUM_0, NUM_9, NUM_DEC, NUM_LSIGN_PRE, OVERLOAD_TEST, and x.
Referenced by NUM_processor().
Definition at line 5535 of file formatting.c.
References elog, fb(), IS_BRACKET, IS_DECIMAL, IS_FILLMODE, IS_LSIGN, IS_PREDEC_SPACE, IS_ROMAN, IS_ZERO, NUM_0, NUM_9, NUM_D, NUM_DEC, NUM_LSIGN_POST, and NUM_LSIGN_PRE.
Referenced by NUM_processor().
Definition at line 5213 of file formatting.c.
References fb(), IS_LDECIMAL, and PGLC_localeconv().
Referenced by NUM_processor().
Definition at line 4823 of file formatting.c.
References fb(), i, n_NUMCache, NUMCache, and NUMCounter.
Referenced by NUM_cache_getnew(), and NUM_cache_search().
|
static |
Definition at line 5738 of file formatting.c.
References AMOUNT_TEST, asc_tolower_z(), FormatNode::character, elog, ereport, errcode(), errmsg(), ERROR, fb(), get_last_relevant_decnum(), get_th(), KeyWord::id, IS_BRACKET, IS_DECIMAL, IS_EEEE, IS_FILLMODE, IS_LSIGN, IS_MINUS, IS_PLUS, IS_ROMAN, IS_ZERO, FormatNode::key, MemSet, Min, NODE_TYPE_ACTION, NODE_TYPE_END, NUM_0, NUM_9, NUM_COMMA, NUM_D, NUM_DEC, NUM_eat_non_data_chars(), NUM_G, NUM_L, NUM_LSIGN_POST, NUM_LSIGN_PRE, NUM_MI, NUM_numpart_from_char(), NUM_numpart_to_char(), NUM_PL, NUM_prepare_locale(), NUM_RN, NUM_rn, NUM_SG, NUM_TH, NUM_th, OVERLOAD_TEST, pg_mblen(), pg_mbstrlen(), roman_to_int(), sign, sprintf, TH_LOWER, TH_UPPER, FormatNode::type, and NUMDesc::zero_start.
Referenced by numeric_to_number().
|
static |
Definition at line 1185 of file formatting.c.
References ereport, errcode(), errdetail(), errmsg(), ERROR, fb(), NUMDesc::flag, KeyWord::id, IS_BLANK, IS_BRACKET, IS_DECIMAL, IS_EEEE, IS_FILLMODE, IS_LSIGN, IS_MINUS, IS_MULTI, IS_PLUS, IS_ROMAN, IS_ZERO, FormatNode::key, NUMDesc::lsign, NUMDesc::multi, NUMDesc::need_locale, NODE_TYPE_ACTION, NUM_0, NUM_9, NUM_B, NUM_D, NUM_DEC, NUM_E, NUM_F_BLANK, NUM_F_BRACKET, NUM_F_DECIMAL, NUM_F_EEEE, NUM_F_FILLMODE, NUM_F_LDECIMAL, NUM_F_LSIGN, NUM_F_MINUS, NUM_F_MINUS_POST, NUM_F_MULTI, NUM_F_PLUS, NUM_F_PLUS_POST, NUM_F_ROMAN, NUM_F_ZERO, NUM_FM, NUM_G, NUM_L, NUM_LSIGN_NONE, NUM_LSIGN_POST, NUM_LSIGN_PRE, NUM_MI, NUM_PL, NUM_PR, NUM_RN, NUM_rn, NUM_S, NUM_SG, NUM_V, NUMDesc::post, NUMDesc::pre, NUMDesc::pre_lsign_num, FormatNode::type, NUMDesc::zero_end, and NUMDesc::zero_start.
Referenced by parse_format().
| Datum numeric_to_char | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6293 of file formatting.c.
References a, b, DatumGetCString(), DatumGetNumeric(), DirectFunctionCall1, DirectFunctionCall2, ErrorSaveContext::error_occurred, fb(), fill_str(), format, Int32GetDatum(), int64_to_numeric(), int_to_roman(), IS_EEEE, IS_MULTI, IS_ROMAN, NUMDesc::multi, NUM_TOCHAR_finish, NUM_TOCHAR_prepare, numeric_int4_safe(), numeric_mul(), numeric_out(), numeric_out_sci(), numeric_power(), numeric_round(), NumericGetDatum(), palloc(), PG_GETARG_NUMERIC, PG_GETARG_TEXT_PP, PG_INT32_MAX, PG_RETURN_TEXT_P, NUMDesc::post, NUMDesc::pre, sign, val, value, and x.
| Datum numeric_to_number | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6235 of file formatting.c.
References a, b, CStringGetDatum(), DatumGetNumeric(), DirectFunctionCall2, DirectFunctionCall3, fb(), format, Int32GetDatum(), int64_to_numeric(), InvalidOid, IS_MULTI, len, NUMDesc::multi, NUM_cache(), NUM_MAX_ITEM_SIZ, NUM_processor(), numeric_in(), numeric_mul(), numeric_power(), NumericGetDatum(), ObjectIdGetDatum(), palloc(), pfree(), PG_GET_COLLATION, PG_GETARG_TEXT_PP, PG_RETURN_NULL, NUMDesc::post, NUMDesc::pre, scale, value, VARDATA_ANY(), VARHDRSZ, VARSIZE_ANY_EXHDR(), and x.
| Datum parse_datetime | ( | text * | date_txt, |
| text * | fmt, | ||
| Oid | collid, | ||
| bool | strict, | ||
| Oid * | typid, | ||
| int32 * | typmod, | ||
| int * | tz, | ||
| Node * | escontext | ||
| ) |
Definition at line 4156 of file formatting.c.
References AdjustTimeForTypmod(), AdjustTimestampForTypmod(), Assert, collid, date2j(), DateADTGetDatum(), DCH_DATED, DCH_TIMED, DCH_ZONED, do_to_timestamp(), ereturn, errcode(), errmsg(), fb(), fmt_tz::gmtoffset, IS_VALID_DATE, IS_VALID_JULIAN, palloc_object, POSTGRES_EPOCH_JDATE, text_to_cstring(), TimeTzADT::time, TimeADTGetDatum(), TimestampGetDatum(), TimestampTzGetDatum(), TimeTzADTPGetDatum(), tm, tm2time(), tm2timestamp(), tm2timetz(), pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
Referenced by executeDateTimeMethod().
|
static |
Definition at line 1370 of file formatting.c.
References FormatNode::character, DCH_FLAG, elog, ereport, errcode(), errmsg(), ERROR, fb(), KeySuffix::id, index_seq_search(), is_separator_char(), FormatNode::key, KeySuffix::len, KeyWord::len, NODE_TYPE_ACTION, NODE_TYPE_CHAR, NODE_TYPE_END, NODE_TYPE_SEPARATOR, NODE_TYPE_SPACE, NUM_FLAG, NUMDesc_prepare(), pg_mblen(), pnstrdup(), STD_FLAG, str, suff_search(), FormatNode::suffix, SUFFTYPE_POSTFIX, SUFFTYPE_PREFIX, and FormatNode::type.
Referenced by datetime_format_has_tz(), datetime_to_char_body(), DCH_cache_fetch(), do_to_timestamp(), NUM_cache(), and NUM_cache_fetch().
Definition at line 5064 of file formatting.c.
References fb(), i, IS_VALID_SUB_COMB, len, MAX_ROMAN_LEN, OVERLOAD_TEST, pg_ascii_toupper(), and ROMAN_VAL.
Referenced by NUM_processor().
Definition at line 2289 of file formatting.c.
References a, fb(), len, name, and pg_ascii_tolower().
Referenced by from_char_seq_search().
|
static |
Definition at line 2342 of file formatting.c.
References a, collid, fb(), len, name, pfree(), str_tolower(), and str_toupper().
Referenced by from_char_seq_search().
Definition at line 1811 of file formatting.c.
References asc_tolower(), Assert, collid, ereport, errcode(), errhint(), errmsg(), ERROR, fb(), GetDatabaseEncoding(), OidIsValid, palloc(), pg_newlocale_from_collation(), pg_strfold(), PG_UTF8, and repalloc().
Referenced by casefold().
Definition at line 1747 of file formatting.c.
References asc_initcap(), Assert, collid, ereport, errcode(), errhint(), errmsg(), ERROR, fb(), OidIsValid, palloc(), pg_newlocale_from_collation(), pg_strtitle(), and repalloc().
Referenced by initcap(), and str_initcap_z().
Definition at line 1966 of file formatting.c.
References collid, fb(), and str_initcap().
Referenced by DCH_to_char().
Definition at line 1619 of file formatting.c.
References asc_tolower(), Assert, collid, ereport, errcode(), errhint(), errmsg(), ERROR, fb(), OidIsValid, palloc(), pg_newlocale_from_collation(), pg_strlower(), and repalloc().
Referenced by citext_eq(), citext_hash(), citext_hash_extended(), citext_ne(), citextcmp(), convertPgWchar(), dispell_init(), dispell_lexize(), dsimple_init(), dsimple_lexize(), dsnowball_init(), dsnowball_lexize(), dsynonym_init(), dsynonym_lexize(), dxsyn_lexize(), generate_trgm_only(), generate_wildcard_trgm(), internal_citext_pattern_cmp(), lower(), lowerstr_ctx(), NIImportAffixes(), read_dictionary(), seq_search_localized(), and str_tolower_z().
Definition at line 1954 of file formatting.c.
References collid, fb(), and str_tolower().
Referenced by DCH_to_char().
Definition at line 1683 of file formatting.c.
References asc_toupper(), Assert, collid, ereport, errcode(), errhint(), errmsg(), ERROR, fb(), OidIsValid, palloc(), pg_newlocale_from_collation(), pg_strupper(), and repalloc().
Referenced by MakeUpper(), seq_search_localized(), str_toupper_z(), and upper().
Definition at line 1960 of file formatting.c.
References collid, fb(), and str_toupper().
Referenced by DCH_to_char().
|
static |
Definition at line 1158 of file formatting.c.
References fb(), KeySuffix::name, str, and type.
Referenced by parse_format().
Definition at line 578 of file formatting.c.
References DCH_SUFFIX_TH, fb(), TH_LOWER, and TH_UPPER.
Referenced by DCH_to_char().
| Datum timestamp_to_char | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3956 of file formatting.c.
References COPY_tm, date2j(), datetime_to_char_body(), ereport, errcode(), errmsg(), ERROR, fb(), PG_GET_COLLATION, PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMP, PG_RETURN_NULL, PG_RETURN_TEXT_P, timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, tmtcFsec, tmtcTm, VARSIZE_ANY_EXHDR(), and ZERO_tmtc.
| Datum timestamptz_to_char | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3991 of file formatting.c.
References COPY_tm, date2j(), datetime_to_char_body(), ereport, errcode(), errmsg(), ERROR, fb(), PG_GET_COLLATION, PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMP, PG_RETURN_NULL, PG_RETURN_TEXT_P, timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, tmtcFsec, tmtcTm, tmtcTzn, VARSIZE_ANY_EXHDR(), and ZERO_tmtc.
| Datum to_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4110 of file formatting.c.
References collid, date2j(), do_to_timestamp(), ereport, errcode(), errmsg(), ERROR, fb(), IS_VALID_DATE, IS_VALID_JULIAN, PG_GET_COLLATION, PG_GETARG_TEXT_PP, PG_RETURN_DATEADT, POSTGRES_EPOCH_JDATE, text_to_cstring(), tm, pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
| Datum to_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4072 of file formatting.c.
References AdjustTimestampForTypmod(), collid, DetermineTimeZoneOffset(), do_to_timestamp(), ereport, errcode(), errmsg(), ERROR, fb(), PG_GET_COLLATION, PG_GETARG_TEXT_PP, PG_RETURN_TIMESTAMP, session_timezone, tm, and tm2timestamp().
Definition at line 207 of file formatting.c.
Referenced by DCH_from_char().
Definition at line 208 of file formatting.c.
Referenced by DCH_from_char().
Definition at line 233 of file formatting.c.
Referenced by DCH_from_char().
Definition at line 234 of file formatting.c.
Referenced by DCH_from_char().
Definition at line 174 of file formatting.c.
Referenced by DCH_from_char(), and DCH_to_char().
|
static |
Definition at line 976 of file formatting.c.
Referenced by datetime_format_has_tz(), datetime_to_char_body(), DCH_cache_fetch(), and do_to_timestamp().
Definition at line 805 of file formatting.c.
Referenced by datetime_format_has_tz(), datetime_to_char_body(), DCH_cache_fetch(), and do_to_timestamp().
Definition at line 601 of file formatting.c.
Referenced by datetime_format_has_tz(), datetime_to_char_body(), DCH_cache_fetch(), and do_to_timestamp().
|
static |
Definition at line 401 of file formatting.c.
Referenced by DCH_cache_getnew(), DCH_cache_search(), and DCH_prevent_counter_overflow().
|
static |
Definition at line 403 of file formatting.c.
Referenced by DCH_cache_getnew(), DCH_cache_search(), and DCH_prevent_counter_overflow().
Definition at line 169 of file formatting.c.
Referenced by DCH_from_char(), and DCH_to_char().
|
static |
Definition at line 402 of file formatting.c.
Referenced by DCH_cache_getnew(), DCH_cache_search(), and DCH_prevent_counter_overflow().
|
static |
Definition at line 407 of file formatting.c.
Referenced by NUM_cache_getnew(), NUM_cache_search(), and NUM_prevent_counter_overflow().
|
static |
Definition at line 999 of file formatting.c.
Referenced by NUM_cache(), and NUM_cache_fetch().
Definition at line 929 of file formatting.c.
Referenced by NUM_cache(), and NUM_cache_fetch().
|
static |
Definition at line 406 of file formatting.c.
Referenced by NUM_cache_getnew(), NUM_cache_search(), and NUM_prevent_counter_overflow().
|
static |
Definition at line 408 of file formatting.c.
Referenced by NUM_cache_getnew(), NUM_cache_search(), and NUM_prevent_counter_overflow().
Definition at line 244 of file formatting.c.
Referenced by DCH_from_char(), and DCH_to_char().