1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
/* icu_ext.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION icu_ext" to load this file. \quit
CREATE FUNCTION icu_version() RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE C;
COMMENT ON FUNCTION icu_version()
IS 'Version of the ICU library currently in use';
CREATE FUNCTION icu_unicode_version() RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE C;
COMMENT ON FUNCTION icu_unicode_version()
IS 'Version of the Unicode standard used by ICU';
CREATE FUNCTION icu_collation_attributes(
IN collator text,
IN exclude_defaults bool default false,
OUT attribute text,
OUT value text
)
RETURNS SETOF record
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
COMMENT ON FUNCTION icu_collation_attributes(text,bool)
IS 'List the attributes of an ICU collation';
CREATE FUNCTION icu_locales_list (
OUT name text,
OUT country text,
OUT country_code text,
OUT language text,
OUT language_code text,
OUT script text,
OUT direction text
)
RETURNS SETOF record
AS 'MODULE_PATHNAME'
LANGUAGE C;
COMMENT ON FUNCTION icu_locales_list()
IS 'List the available ICU locales with their main properties';
CREATE FUNCTION icu_default_locale() RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE C;
COMMENT ON FUNCTION icu_default_locale()
IS 'Return the ICU locale currently used by default';
/* Set the default locale to some name and return
the canonicalized name. */
CREATE FUNCTION icu_set_default_locale(text) RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
COMMENT ON FUNCTION icu_set_default_locale(text)
IS 'Set the ICU locale used by default';
/* See http://userguide.icu-project.org/boundaryanalysis */
CREATE FUNCTION icu_character_boundaries(
contents text,
locale text
) RETURNS SETOF text
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
COMMENT ON FUNCTION icu_character_boundaries(text,text)
IS 'Split text into characters, using boundary positions according to Unicode rules with the specified locale';
CREATE FUNCTION icu_word_boundaries(
contents text,
locale text,
OUT tag int,
OUT contents text
) RETURNS SETOF record
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
COMMENT ON FUNCTION icu_word_boundaries(text,text)
IS 'Split text into words, using boundary positions according to Unicode rules with the specified locale';
CREATE FUNCTION icu_line_boundaries(
contents text,
locale text,
OUT tag int,
OUT contents text
) RETURNS SETOF record
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
COMMENT ON FUNCTION icu_line_boundaries(text,text)
IS 'Split text into parts between which line breaks may occur, using rules of the specified locale';
CREATE FUNCTION icu_sentence_boundaries(
contents text,
locale text,
OUT tag int,
OUT contents text
) RETURNS SETOF record
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
COMMENT ON FUNCTION icu_sentence_boundaries(text,text)
IS 'Split text into sentences, according to Unicode rules with the specified locale';
CREATE FUNCTION icu_compare(
str1 text,
str2 text
) RETURNS int
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
COMMENT ON FUNCTION icu_compare(text,text)
IS 'Compare two strings with their ICU collation and return a signed int like strcoll';
CREATE FUNCTION icu_compare(
str1 text,
str2 text,
collator text
) RETURNS int
AS 'MODULE_PATHNAME', 'icu_compare_coll'
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
COMMENT ON FUNCTION icu_compare(text,text,text)
IS 'Compare two strings with the given collation and return a signed int like strcoll';
CREATE FUNCTION icu_case_compare(
str1 text,
str2 text
) RETURNS int
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
COMMENT ON FUNCTION icu_case_compare(text,text)
IS 'Compare two strings case-insensitively using full case folding';
CREATE FUNCTION icu_sort_key(
str text,
collator text
) RETURNS bytea
AS 'MODULE_PATHNAME', 'icu_sort_key_coll'
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE COST 10;
COMMENT ON FUNCTION icu_sort_key(text,text)
IS 'Compute the binary sort key for the string given the collation';
CREATE FUNCTION icu_sort_key(
str text
) RETURNS bytea
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE COST 10;
COMMENT ON FUNCTION icu_sort_key(text)
IS 'Compute the binary sort key with the collate of the string';
CREATE FUNCTION icu_char_name(
c character
) RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT STABLE;
COMMENT ON FUNCTION icu_char_name(character)
IS 'Return the Unicode character name corresponding to the first codepoint of the input';
CREATE FUNCTION icu_number_spellout(
num float8,
locale text
) RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT STABLE;
COMMENT ON FUNCTION icu_number_spellout(float8,text)
IS 'Spell out the number according to the given locale';
CREATE FUNCTION icu_spoof_check(
str text
) RETURNS boolean
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT STABLE PARALLEL SAFE;
COMMENT ON FUNCTION icu_spoof_check(text)
IS 'Check whether the argument is likely to be an attempt at confusing a reader';
CREATE FUNCTION icu_confusable_strings_check(
str1 text,
str2 text
) RETURNS boolean
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT STABLE PARALLEL SAFE;
COMMENT ON FUNCTION icu_confusable_strings_check(text,text)
IS 'Check whether the arguments are visually confusable with each other';
CREATE FUNCTION icu_transforms_list(
)
RETURNS SETOF text
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
COMMENT ON FUNCTION icu_transforms_list()
IS 'List the basic transforms available to icu_transform';
CREATE FUNCTION icu_transform(string text, trans text) RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
COMMENT ON FUNCTION icu_transform(text,text)
IS 'Apply a transformation through basic or compound transliterators and filters';
|