#include "postgres.h"
#include "access/xact.h"
#include "catalog/namespace.h"
#include "mb/pg_wchar.h"
#include "utils/fmgrprotos.h"
#include "utils/memutils.h"
#include "utils/relcache.h"
#include "varatt.h"
Go to the source code of this file.
Definition at line 1670 of file mbutils.c.
References elog, ERROR, len, name, pg_enc2name_tbl, and PG_VALID_ENCODING.
Definition at line 1151 of file mbutils.c.
Referenced by pg_encoding_mbcliplen(), pg_mbcharcliplen(), and pgstat_clip_activity().
Definition at line 1274 of file mbutils.c.
References CStringGetDatum(), DatabaseEncoding, DirectFunctionCall1, pg_enc2name::name, and namein().
Definition at line 1262 of file mbutils.c.
References DatabaseEncoding, and pg_enc2name::encoding.
Referenced by ascii(), BeginCopyFrom(), BeginCopyTo(), char2wchar(), chr(), CollationCreate(), CollationGetCollid(), compareStrings(), convert_from_utf8(), convert_to_utf8(), CopyConversionError(), CopyConvertBuf(), create_pg_locale_builtin(), create_pg_locale_icu(), create_pg_locale_libc(), cstr2sv(), dblink_connect(), dblink_get_conn(), DefineCollation(), Generic_Text_IC_like(), GenericMatchText(), get_collation_oid(), get_json_object_as_hash(), InitializeClientEncoding(), IsThereCollationInNamespace(), json_recv(), jsonb_from_cstring(), locate_stem_module(), LogicalOutputWrite(), makeJsonLexContext(), p_isspecial(), ParallelWorkerMain(), pg_database_encoding_character_incrementer(), pg_database_encoding_max_length(), pg_generic_charinc(), pg_perm_setlocale(), pg_unicode_to_server(), pg_unicode_to_server_noerror(), pg_verifymbstr(), pgss_store(), PLyUnicode_Bytes(), populate_array_json(), PrepareClientEncoding(), read_extension_script_file(), SetClientEncoding(), str_casefold(), sv2cstr(), text_position_setup(), to_ascii_default(), tolower_libc_mb(), tolower_libc_sb(), toupper_libc_mb(), toupper_libc_sb(), type_maximum_size(), unicode_assigned(), unicode_norm_form_from_string(), wchar2char(), xml_in(), xml_is_document(), xmlparse(), and xmltotext_with_options().
Definition at line 1268 of file mbutils.c.
References DatabaseEncoding, and pg_enc2name::name.
Referenced by check_client_encoding(), CheckMyDatabase(), connect_pg_server(), dblink_connect(), dblink_get_conn(), get_collation_oid(), InitializeClientEncoding(), IsThereCollationInNamespace(), json_errdetail(), libpqrcv_connect(), locate_stem_module(), pg_unicode_to_server(), ProcessConfigFileInternal(), and regcollationin().
Definition at line 1309 of file mbutils.c.
References pg_enc2name::encoding, and MessageEncoding.
Definition at line 282 of file mbutils.c.
References Assert(), AssertCouldGetRelation(), backend_startup_complete, ereport, errcode(), errmsg(), FATAL, FindDefaultConversionProc(), fmgr_info_cxt(), GetDatabaseEncoding(), GetDatabaseEncodingName(), MemoryContextAlloc(), name, OidIsValid, pending_client_encoding, pg_enc2name_tbl, PG_SQL_ASCII, PG_UTF8, PrepareClientEncoding(), SetClientEncoding(), TopMemoryContext, and Utf8ToServerConvProc.
Referenced by InitPostgres().
Definition at line 616 of file mbutils.c.
References ereport, errcode(), errmsg(), ERROR, len, NameStr, pg_char_to_encoding, PG_GETARG_BYTEA_PP, PG_GETARG_NAME, PG_RETURN_INT32, pg_verify_mbstr_len(), VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
Definition at line 784 of file mbutils.c.
References BoolGetDatum(), ClientEncoding, CStringGetDatum(), CurrentMemoryContext, DatabaseEncoding, pg_enc2name::encoding, ereport, errcode(), errdetail(), errmsg(), ERROR, FunctionCall6, Int32GetDatum(), len, MAX_CONVERSION_GROWTH, MaxAllocHugeSize, MaxAllocSize, MemoryContextAllocHuge(), repalloc(), ToClientConvProc, ToServerConvProc, and unconstify.
Referenced by pg_any_to_server(), and pg_server_to_any().
Definition at line 677 of file mbutils.c.
References ClientEncoding, DatabaseEncoding, encoding, pg_enc2name::encoding, ereport, errcode(), errmsg(), ERROR, i, IS_HIGHBIT_SET, len, name, perform_default_encoding_conversion(), pg_do_encoding_conversion(), pg_enc2name_tbl, PG_SQL_ASCII, PG_VALID_BE_ENCODING, pg_verify_mbstr(), and unconstify.
Referenced by ASN1_STRING_to_text(), cache_single_string(), db_encoding_convert(), dsnowball_lexize(), pg_client_to_server(), pg_stat_statements_internal(), pgp_armor_headers(), PLyUnicode_Bytes(), read_extension_script_file(), tsearch_readline(), utf_u2e(), X509_NAME_to_cstring(), and xml_recv().
Definition at line 1286 of file mbutils.c.
References NameStr, pg_char_to_encoding, PG_GETARG_NAME, and PG_RETURN_INT32.
Definition at line 1280 of file mbutils.c.
References ClientEncoding, CStringGetDatum(), DirectFunctionCall1, pg_enc2name::name, and namein().
Definition at line 661 of file mbutils.c.
References ClientEncoding, pg_enc2name::encoding, len, and pg_any_to_server().
Referenced by exec_bind_message(), parse_fcall_arguments(), pq_getmsgstring(), and pq_getmsgtext().
Definition at line 554 of file mbutils.c.
References ereport, errcode(), errmsg(), ERROR, len, NameStr, palloc(), pfree(), pg_char_to_encoding, pg_do_encoding_conversion(), PG_FREE_IF_COPY, PG_GETARG_BYTEA_PP, PG_GETARG_NAME, PG_RETURN_BYTEA_P, pg_verify_mbstr(), SET_VARSIZE(), unconstify, VARDATA(), VARDATA_ANY(), VARHDRSZ, and VARSIZE_ANY_EXHDR().
Referenced by pg_convert_from(), and pg_convert_to().
Definition at line 527 of file mbutils.c.
References CStringGetDatum(), DatabaseEncoding, DirectFunctionCall1, DirectFunctionCall3, pg_enc2name::name, namein(), pg_convert(), PG_GETARG_DATUM, and PG_RETURN_DATUM.
Definition at line 502 of file mbutils.c.
References CStringGetDatum(), DatabaseEncoding, DirectFunctionCall1, DirectFunctionCall3, pg_enc2name::name, namein(), pg_convert(), PG_GETARG_DATUM, and PG_RETURN_DATUM.
Definition at line 1524 of file mbutils.c.
References GetDatabaseEncoding(), PG_EUC_JP, pg_eucjp_increment(), pg_generic_charinc(), PG_UTF8, and pg_utf8_increment().
Referenced by make_greater_string().
Definition at line 1547 of file mbutils.c.
References GetDatabaseEncoding(), pg_wchar_tbl::maxmblen, and pg_wchar_table.
Referenced by bpcharlen(), char_is_cased_libc(), char_tolower_libc(), charlen_to_bytelen(), create_pg_locale_libc(), dotrim(), downcase_identifier(), gbt_bpchar_consistent(), gbt_text_compress(), gbt_text_consistent(), generate_trgm_only(), Generic_Text_IC_like(), GenericMatchText(), infix(), init_tsvector_parser(), like_escape(), like_fixed_prefix(), lpad(), pg_mbcharcliplen(), pg_mbstrlen(), pg_mbstrlen_with_len(), protect_out_of_mem(), regexp_fixed_prefix(), rpad(), setup_regexp_matches(), setup_test_matches(), show_trgm(), strlower_libc_mb(), strtitle_libc_mb(), strupper_libc_mb(), text_length(), text_position_setup(), text_reverse(), text_substring(), TParserInit(), translate(), and tsvectorout().
Definition at line 357 of file mbutils.c.
References BoolGetDatum(), CStringGetDatum(), CurrentMemoryContext, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, FindDefaultConversionProc(), Int32GetDatum(), IsTransactionState(), len, MAX_CONVERSION_GROWTH, MaxAllocHugeSize, MaxAllocSize, MemoryContextAllocHuge(), OidFunctionCall6, OidIsValid, pg_encoding_to_char, PG_SQL_ASCII, pg_verify_mbstr(), and repalloc().
Referenced by convert_charset(), pg_any_to_server(), pg_convert(), and pg_server_to_any().
Definition at line 470 of file mbutils.c.
References BoolGetDatum(), CStringGetDatum(), DatumGetInt32(), generate_unaccent_rules::dest, Int32GetDatum(), MAX_CONVERSION_GROWTH, and OidFunctionCall6.
Referenced by CopyConversionError(), CopyConvertBuf(), and test_enc_conversion().
Definition at line 1031 of file mbutils.c.
References DatabaseEncoding, pg_wchar_tbl::dsplen, pg_enc2name::encoding, and pg_wchar_table.
Referenced by p_isspecial().
Definition at line 645 of file mbutils.c.
References encoding, PG_GETARG_INT32, PG_RETURN_INT32, PG_RETURN_NULL, PG_VALID_ENCODING, and pg_wchar_table.
Definition at line 994 of file mbutils.c.
References encoding, len, pg_wchar_tbl::mb2wchar_with_len, and pg_wchar_table.
Definition at line 1094 of file mbutils.c.
References cliplen(), encoding, len, pg_wchar_tbl::mblen, pg_encoding_max_length(), and pg_wchar_table.
Referenced by pg_mbcliplen().
Definition at line 1294 of file mbutils.c.
References CStringGetDatum(), DirectFunctionCall1, encoding, namein(), pg_encoding_to_char, and PG_GETARG_INT32.
Definition at line 1016 of file mbutils.c.
References encoding, len, pg_wchar_table, and pg_wchar_tbl::wchar2mb_with_len.
Definition at line 1438 of file mbutils.c.
References i, IS_HIGHBIT_SET, SS2, and SS3.
Referenced by pg_database_encoding_character_incrementer().
Definition at line 1326 of file mbutils.c.
References GetDatabaseEncoding(), len, pg_wchar_tbl::mbverifychar, and pg_wchar_table.
Referenced by pg_database_encoding_character_incrementer().
Definition at line 337 of file mbutils.c.
References ClientEncoding, and pg_enc2name::encoding.
Referenced by BeginCopyFrom(), BeginCopyTo(), and xml_send().
Definition at line 346 of file mbutils.c.
References ClientEncoding, and pg_enc2name::name.
Definition at line 980 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, pg_wchar_tbl::mb2wchar_with_len, and pg_wchar_table.
Definition at line 987 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, len, pg_wchar_tbl::mb2wchar_with_len, and pg_wchar_table.
Referenced by CheckAffix(), NIAddAffix(), RE_compile(), RE_compile_and_cache(), RE_execute(), regcomp_auth_token(), regexec_auth_token(), replace_text_regexp(), setup_regexp_matches(), setup_test_matches(), test_re_compile(), and TParserInit().
Definition at line 1126 of file mbutils.c.
References cliplen(), len, pg_database_encoding_max_length(), and pg_mblen().
Referenced by bpchar(), bpchar_input(), text_left(), text_right(), varchar(), and varchar_input().
Definition at line 1084 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, len, and pg_encoding_mbcliplen().
Referenced by appendStringInfoStringQuoted(), bpchar_name(), ChooseIndexColumnNames(), CopyLimitPrintoutLength(), cvt_text_name(), ExecBuildSlotPartitionKeyDescription(), ExecBuildSlotValueDescription(), make_colname_unique(), make_greater_string(), makeMultirangeTypeName(), makeObjectName(), MemoryContextStatsPrint(), nameconcatoid(), namein(), pgstat_clip_activity(), pgstat_report_appname(), PutMemoryContextsStatsTupleStore(), set_rtable_names(), text_name(), text_to_cstring_buffer(), and truncate_identifier().
Definition at line 1024 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, pg_wchar_tbl::mblen, and pg_wchar_table.
Referenced by addCompoundAffixFlagValue(), bit_in(), charlen_to_bytelen(), DCH_from_char(), dotrim(), find_word(), findchar(), findchar2(), findwrd(), gbt_var_node_cp_len(), get_modifiers(), get_nextfield(), get_wildcard_part(), getlexeme(), getNextFlagFromString(), gettoken_query(), gettoken_query_standard(), gettoken_query_websearch(), gettoken_tsvector(), hex_decode_safe(), infix(), initTrie(), lpad(), make_trigrams(), map_sql_identifier_to_xml_name(), map_xml_name_to_sql_identifier(), match_prosrc_to_literal(), mb_strchr(), NIImportAffixes(), NIImportDictionary(), NIImportOOAffixes(), NUM_eat_non_data_chars(), NUM_processor(), parse_affentry(), parse_format(), parse_lquery(), parse_ltree(), parse_or_operator(), parse_re_flags(), parse_test_flags(), pg_base64_decode_internal(), pg_mbcharcliplen(), pg_mbstrlen(), pg_mbstrlen_with_len(), prssyntaxerror(), px_crypt_shacrypt(), readstoplist(), report_json_context(), rpad(), RS_compile(), RS_execute(), RS_isRegis(), similar_escape_internal(), split_text(), t_isalnum(), t_isalpha(), text_format(), text_position_next(), text_position_next_internal(), text_reverse(), text_substring(), text_to_bits(), textregexreplace(), thesaurusRead(), TParserGet(), translate(), ts_stat_sql(), tsvectorout(), unaccent_lexize(), varbit_in(), varstr_levenshtein(), and wchareq().
Definition at line 1038 of file mbutils.c.
References len, pg_database_encoding_max_length(), and pg_mblen().
Referenced by NUM_processor(), and text_format_append_string().
Definition at line 1058 of file mbutils.c.
References len, pg_database_encoding_max_length(), and pg_mblen().
Referenced by bpchar(), bpchar_input(), bpcharlen(), executor_errposition(), lpad(), match_prosrc_to_query(), parser_errposition(), plpgsql_scanner_errposition(), rpad(), scanner_errposition(), similar_escape_internal(), text_left(), text_length(), text_position_get_match_pos(), text_right(), text_substring(), unicode_assigned(), unicode_is_normalized(), unicode_normalize_func(), and varstr_levenshtein().
Definition at line 750 of file mbutils.c.
References ClientEncoding, DatabaseEncoding, encoding, pg_enc2name::encoding, len, perform_default_encoding_conversion(), pg_do_encoding_conversion(), PG_SQL_ASCII, pg_verify_mbstr(), and unconstify.
Referenced by compareStrings(), CopyAttributeOutCSV(), CopyAttributeOutText(), CopyToTextLikeStart(), daitch_mokotoff(), dsnowball_lexize(), hv_fetch_string(), hv_store_string(), pg_server_to_client(), PLyUnicode_FromStringAndSize(), and utf_e2u().
Definition at line 739 of file mbutils.c.
References ClientEncoding, pg_enc2name::encoding, len, and pg_server_to_any().
Referenced by pq_puttextmessage(), pq_sendcountedtext(), pq_sendstring(), pq_sendtext(), and pq_writestring().
Definition at line 865 of file mbutils.c.
References BoolGetDatum(), CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, FunctionCall6, GetDatabaseEncoding(), GetDatabaseEncodingName(), Int32GetDatum(), is_valid_unicode_codepoint(), MAX_MULTIBYTE_CHAR_LEN, name, pg_enc2name_tbl, PG_UTF8, pg_utf_mblen, unicode_to_utf8(), and Utf8ToServerConvProc.
Referenced by addunicode(), addUnicodeChar(), map_xml_name_to_sql_identifier(), str_udeescape(), and unistr().
Definition at line 927 of file mbutils.c.
References BoolGetDatum(), CStringGetDatum(), DatumGetInt32(), FunctionCall6, GetDatabaseEncoding(), Int32GetDatum(), is_valid_unicode_codepoint(), MAX_MULTIBYTE_CHAR_LEN, PG_UTF8, pg_utf_mblen, unicode_to_utf8(), and Utf8ToServerConvProc.
Referenced by addUnicodeChar(), and json_lex_string().
Definition at line 1360 of file mbutils.c.
References a.
Referenced by pg_database_encoding_character_incrementer().
Definition at line 1567 of file mbutils.c.
References Assert(), encoding, len, pg_wchar_tbl::mbverifystr, PG_VALID_ENCODING, pg_wchar_table, and report_invalid_encoding().
Referenced by AddFileToBackupManifest(), LogicalOutputWrite(), pg_any_to_server(), pg_convert(), pg_do_encoding_conversion(), pg_server_to_any(), pg_verifymbstr(), and read_extension_script_file().
Definition at line 1598 of file mbutils.c.
References Assert(), encoding, IS_HIGHBIT_SET, len, pg_wchar_tbl::mbverifychar, pg_encoding_max_length(), PG_VALID_ENCODING, pg_wchar_table, and report_invalid_encoding().
Referenced by length_in_encoding().
Definition at line 1557 of file mbutils.c.
References GetDatabaseEncoding(), len, and pg_verify_mbstr().
Referenced by char2wchar(), CopyReadAttributesText(), plperl_spi_exec(), plperl_spi_prepare(), plperl_spi_query(), PLy_cursor_query(), PLy_output(), PLy_spi_execute_query(), PLy_spi_prepare(), PLyObject_AsString(), read_text_file(), and spg_text_leaf_consistent().
Definition at line 1002 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, pg_wchar_strlen(), pg_wchar_table, and pg_wchar_tbl::wchar2mb_with_len.
Definition at line 1009 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, len, pg_wchar_table, and pg_wchar_tbl::wchar2mb_with_len.
Referenced by build_regexp_match_result(), build_regexp_split_result(), build_test_match_result(), convertPgWchar(), and regexp_fixed_prefix().
Definition at line 111 of file mbutils.c.
References backend_startup_complete, ConvProcInfo::c_encoding, ConvProcList, encoding, FindDefaultConversionProc(), fmgr_info_cxt(), GetDatabaseEncoding(), IsTransactionState(), lcons(), lfirst, MemoryContextAlloc(), MemoryContextSwitchTo(), OidIsValid, PG_SQL_ASCII, PG_VALID_FE_ENCODING, ConvProcInfo::s_encoding, ConvProcInfo::to_client_info, ConvProcInfo::to_server_info, and TopMemoryContext.
Referenced by check_client_encoding(), and InitializeClientEncoding().
Definition at line 1699 of file mbutils.c.
References buf, encoding, ereport, errcode(), errmsg(), ERROR, j, len, Min, name, pg_enc2name_tbl, pg_encoding_mblen_or_incomplete(), and sprintf.
Referenced by big52euc_tw(), big52mic(), CopyConversionError(), euc_cn2mic(), euc_jis_20042shift_jis_2004(), euc_jp2mic(), euc_jp2sjis(), euc_kr2mic(), euc_tw2big5(), euc_tw2mic(), iso8859_1_to_utf8(), latin2mic(), latin2mic_with_table(), local2local(), LocalToUtf(), mic2big5(), mic2euc_cn(), mic2euc_jp(), mic2euc_kr(), mic2euc_tw(), mic2latin(), mic2latin_with_table(), mic2sjis(), pg_verify_mbstr(), pg_verify_mbstr_len(), shift_jis_20042euc_jis_2004(), sjis2euc_jp(), sjis2mic(), test_enc_conversion(), utf8_to_iso8859_1(), and UtfToLocal().
Definition at line 1731 of file mbutils.c.
References buf, ereport, errcode(), errmsg(), ERROR, j, len, Min, name, pg_enc2name_tbl, pg_encoding_mblen_or_incomplete(), and sprintf.
Referenced by big52euc_tw(), big52mic(), euc_tw2big5(), latin2mic_with_table(), local2local(), LocalToUtf(), mic2big5(), mic2euc_cn(), mic2euc_jp(), mic2euc_kr(), mic2euc_tw(), mic2latin(), mic2latin_with_table(), mic2sjis(), utf8_to_iso8859_1(), and UtfToLocal().
Definition at line 209 of file mbutils.c.
References backend_startup_complete, ConvProcInfo::c_encoding, ClientEncoding, ConvProcList, encoding, foreach_delete_current, GetDatabaseEncoding(), lfirst, pending_client_encoding, pfree(), pg_enc2name_tbl, PG_SQL_ASCII, PG_VALID_FE_ENCODING, ConvProcInfo::s_encoding, ConvProcInfo::to_client_info, ConvProcInfo::to_server_info, ToClientConvProc, and ToServerConvProc.
Referenced by assign_client_encoding(), InitializeClientEncoding(), and ParallelWorkerMain().
Definition at line 1162 of file mbutils.c.
References Assert(), DatabaseEncoding, elog, encoding, pg_enc2name::encoding, ERROR, pg_enc2name_tbl, and PG_VALID_BE_ENCODING.
Referenced by CheckMyDatabase().
Definition at line 1172 of file mbutils.c.
References Assert(), encoding, pg_enc2name::encoding, MessageEncoding, pg_enc2name_tbl, and PG_VALID_ENCODING.
Referenced by pg_perm_setlocale().
Definition at line 91 of file mbutils.c.
Referenced by InitializeClientEncoding(), PrepareClientEncoding(), and SetClientEncoding().
Definition at line 81 of file mbutils.c.
Referenced by perform_default_encoding_conversion(), pg_any_to_server(), pg_client_encoding(), pg_client_to_server(), pg_get_client_encoding(), pg_get_client_encoding_name(), pg_server_to_any(), pg_server_to_client(), and SetClientEncoding().
Definition at line 62 of file mbutils.c.
Referenced by PrepareClientEncoding(), and SetClientEncoding().
Definition at line 82 of file mbutils.c.
Referenced by getdatabaseencoding(), GetDatabaseEncoding(), GetDatabaseEncodingName(), perform_default_encoding_conversion(), pg_any_to_server(), pg_convert_from(), pg_convert_to(), pg_dsplen(), pg_mb2wchar(), pg_mb2wchar_with_len(), pg_mbcliplen(), pg_mblen(), pg_server_to_any(), pg_wchar2mb(), pg_wchar2mb_with_len(), and SetDatabaseEncoding().
Definition at line 83 of file mbutils.c.
Referenced by GetMessageEncoding(), and SetMessageEncoding().
Definition at line 92 of file mbutils.c.
Referenced by InitializeClientEncoding(), and SetClientEncoding().
Definition at line 69 of file mbutils.c.
Referenced by perform_default_encoding_conversion(), and SetClientEncoding().
Definition at line 68 of file mbutils.c.
Referenced by perform_default_encoding_conversion(), and SetClientEncoding().
Definition at line 76 of file mbutils.c.
Referenced by InitializeClientEncoding(), pg_unicode_to_server(), and pg_unicode_to_server_noerror().