github.com/dolthub/go-mysql-server@v0.18.0/sql/collations.go (about)

     1  // Copyright 2022-2023 Dolthub, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package sql
    16  
    17  import (
    18  	"fmt"
    19  	"io"
    20  	"strings"
    21  	"sync"
    22  	"unicode/utf8"
    23  
    24  	"github.com/cespare/xxhash/v2"
    25  
    26  	"github.com/dolthub/go-mysql-server/sql/encodings"
    27  )
    28  
    29  // Collation represents the collation of a string.
    30  type Collation struct {
    31  	ID                CollationID
    32  	Name              string
    33  	CharacterSet      CharacterSetID
    34  	IsDefault         bool
    35  	IsCompiled        bool
    36  	IsCaseSensitive   bool
    37  	IsAccentSensitive bool
    38  	SortLength        uint8
    39  	PadAttribute      string
    40  	Sorter            CollationSorter
    41  }
    42  
    43  // CollationSorter is a collation's sort function. When given a rune, an integer is returned that represents that rune's
    44  // order when sorted against all other runes. That integer is referred to as a sort order. When two runes have the same
    45  // sort order, they are considered equivalent. For example, case-insensitive collations return the same sort order for
    46  // uppercase and lowercase variants of a character, while case-sensitive collations return different sort orders.
    47  // Comparing sort orders from different collations is meaningless, and therefore represents a logical error.
    48  type CollationSorter func(r rune) int32
    49  
    50  // CollationsIterator iterates over every collation available, ordered by their ID (ascending).
    51  type CollationsIterator struct {
    52  	idx int
    53  }
    54  
    55  var collationStringToID = map[string]CollationID{}
    56  
    57  // CollationID represents the collation's unique identifier. May be safely converted to and from an uint16 for storage.
    58  type CollationID uint16
    59  
    60  // The collations below are ordered alphabetically to make it easier to visually parse them.
    61  // Each collation's ID matches the ID from MySQL, which may be obtained by running `SHOW COLLATIONS;` on a MySQL server.
    62  // These are guaranteed to be stable.
    63  
    64  const (
    65  	Collation_armscii8_bin                CollationID = 64
    66  	Collation_armscii8_general_ci         CollationID = 32
    67  	Collation_ascii_bin                   CollationID = 65
    68  	Collation_ascii_general_ci            CollationID = 11
    69  	Collation_big5_bin                    CollationID = 84
    70  	Collation_big5_chinese_ci             CollationID = 1
    71  	Collation_binary                      CollationID = 63
    72  	Collation_cp1250_bin                  CollationID = 66
    73  	Collation_cp1250_croatian_ci          CollationID = 44
    74  	Collation_cp1250_czech_cs             CollationID = 34
    75  	Collation_cp1250_general_ci           CollationID = 26
    76  	Collation_cp1250_polish_ci            CollationID = 99
    77  	Collation_cp1251_bin                  CollationID = 50
    78  	Collation_cp1251_bulgarian_ci         CollationID = 14
    79  	Collation_cp1251_general_ci           CollationID = 51
    80  	Collation_cp1251_general_cs           CollationID = 52
    81  	Collation_cp1251_ukrainian_ci         CollationID = 23
    82  	Collation_cp1256_bin                  CollationID = 67
    83  	Collation_cp1256_general_ci           CollationID = 57
    84  	Collation_cp1257_bin                  CollationID = 58
    85  	Collation_cp1257_general_ci           CollationID = 59
    86  	Collation_cp1257_lithuanian_ci        CollationID = 29
    87  	Collation_cp850_bin                   CollationID = 80
    88  	Collation_cp850_general_ci            CollationID = 4
    89  	Collation_cp852_bin                   CollationID = 81
    90  	Collation_cp852_general_ci            CollationID = 40
    91  	Collation_cp866_bin                   CollationID = 68
    92  	Collation_cp866_general_ci            CollationID = 36
    93  	Collation_cp932_bin                   CollationID = 96
    94  	Collation_cp932_japanese_ci           CollationID = 95
    95  	Collation_dec8_bin                    CollationID = 69
    96  	Collation_dec8_swedish_ci             CollationID = 3
    97  	Collation_eucjpms_bin                 CollationID = 98
    98  	Collation_eucjpms_japanese_ci         CollationID = 97
    99  	Collation_euckr_bin                   CollationID = 85
   100  	Collation_euckr_korean_ci             CollationID = 19
   101  	Collation_gb18030_bin                 CollationID = 249
   102  	Collation_gb18030_chinese_ci          CollationID = 248
   103  	Collation_gb18030_unicode_520_ci      CollationID = 250
   104  	Collation_gb2312_bin                  CollationID = 86
   105  	Collation_gb2312_chinese_ci           CollationID = 24
   106  	Collation_gbk_bin                     CollationID = 87
   107  	Collation_gbk_chinese_ci              CollationID = 28
   108  	Collation_geostd8_bin                 CollationID = 93
   109  	Collation_geostd8_general_ci          CollationID = 92
   110  	Collation_greek_bin                   CollationID = 70
   111  	Collation_greek_general_ci            CollationID = 25
   112  	Collation_hebrew_bin                  CollationID = 71
   113  	Collation_hebrew_general_ci           CollationID = 16
   114  	Collation_hp8_bin                     CollationID = 72
   115  	Collation_hp8_english_ci              CollationID = 6
   116  	Collation_keybcs2_bin                 CollationID = 73
   117  	Collation_keybcs2_general_ci          CollationID = 37
   118  	Collation_koi8r_bin                   CollationID = 74
   119  	Collation_koi8r_general_ci            CollationID = 7
   120  	Collation_koi8u_bin                   CollationID = 75
   121  	Collation_koi8u_general_ci            CollationID = 22
   122  	Collation_latin1_bin                  CollationID = 47
   123  	Collation_latin1_danish_ci            CollationID = 15
   124  	Collation_latin1_general_ci           CollationID = 48
   125  	Collation_latin1_general_cs           CollationID = 49
   126  	Collation_latin1_german1_ci           CollationID = 5
   127  	Collation_latin1_german2_ci           CollationID = 31
   128  	Collation_latin1_spanish_ci           CollationID = 94
   129  	Collation_latin1_swedish_ci           CollationID = 8
   130  	Collation_latin2_bin                  CollationID = 77
   131  	Collation_latin2_croatian_ci          CollationID = 27
   132  	Collation_latin2_czech_cs             CollationID = 2
   133  	Collation_latin2_general_ci           CollationID = 9
   134  	Collation_latin2_hungarian_ci         CollationID = 21
   135  	Collation_latin5_bin                  CollationID = 78
   136  	Collation_latin5_turkish_ci           CollationID = 30
   137  	Collation_latin7_bin                  CollationID = 79
   138  	Collation_latin7_estonian_cs          CollationID = 20
   139  	Collation_latin7_general_ci           CollationID = 41
   140  	Collation_latin7_general_cs           CollationID = 42
   141  	Collation_macce_bin                   CollationID = 43
   142  	Collation_macce_general_ci            CollationID = 38
   143  	Collation_macroman_bin                CollationID = 53
   144  	Collation_macroman_general_ci         CollationID = 39
   145  	Collation_sjis_bin                    CollationID = 88
   146  	Collation_sjis_japanese_ci            CollationID = 13
   147  	Collation_swe7_bin                    CollationID = 82
   148  	Collation_swe7_swedish_ci             CollationID = 10
   149  	Collation_tis620_bin                  CollationID = 89
   150  	Collation_tis620_thai_ci              CollationID = 18
   151  	Collation_ucs2_bin                    CollationID = 90
   152  	Collation_ucs2_croatian_ci            CollationID = 149
   153  	Collation_ucs2_czech_ci               CollationID = 138
   154  	Collation_ucs2_danish_ci              CollationID = 139
   155  	Collation_ucs2_esperanto_ci           CollationID = 145
   156  	Collation_ucs2_estonian_ci            CollationID = 134
   157  	Collation_ucs2_general_ci             CollationID = 35
   158  	Collation_ucs2_general_mysql500_ci    CollationID = 159
   159  	Collation_ucs2_german2_ci             CollationID = 148
   160  	Collation_ucs2_hungarian_ci           CollationID = 146
   161  	Collation_ucs2_icelandic_ci           CollationID = 129
   162  	Collation_ucs2_latvian_ci             CollationID = 130
   163  	Collation_ucs2_lithuanian_ci          CollationID = 140
   164  	Collation_ucs2_persian_ci             CollationID = 144
   165  	Collation_ucs2_polish_ci              CollationID = 133
   166  	Collation_ucs2_roman_ci               CollationID = 143
   167  	Collation_ucs2_romanian_ci            CollationID = 131
   168  	Collation_ucs2_sinhala_ci             CollationID = 147
   169  	Collation_ucs2_slovak_ci              CollationID = 141
   170  	Collation_ucs2_slovenian_ci           CollationID = 132
   171  	Collation_ucs2_spanish2_ci            CollationID = 142
   172  	Collation_ucs2_spanish_ci             CollationID = 135
   173  	Collation_ucs2_swedish_ci             CollationID = 136
   174  	Collation_ucs2_turkish_ci             CollationID = 137
   175  	Collation_ucs2_unicode_520_ci         CollationID = 150
   176  	Collation_ucs2_unicode_ci             CollationID = 128
   177  	Collation_ucs2_vietnamese_ci          CollationID = 151
   178  	Collation_ujis_bin                    CollationID = 91
   179  	Collation_ujis_japanese_ci            CollationID = 12
   180  	Collation_utf16_bin                   CollationID = 55
   181  	Collation_utf16_croatian_ci           CollationID = 122
   182  	Collation_utf16_czech_ci              CollationID = 111
   183  	Collation_utf16_danish_ci             CollationID = 112
   184  	Collation_utf16_esperanto_ci          CollationID = 118
   185  	Collation_utf16_estonian_ci           CollationID = 107
   186  	Collation_utf16_general_ci            CollationID = 54
   187  	Collation_utf16_german2_ci            CollationID = 121
   188  	Collation_utf16_hungarian_ci          CollationID = 119
   189  	Collation_utf16_icelandic_ci          CollationID = 102
   190  	Collation_utf16_latvian_ci            CollationID = 103
   191  	Collation_utf16_lithuanian_ci         CollationID = 113
   192  	Collation_utf16_persian_ci            CollationID = 117
   193  	Collation_utf16_polish_ci             CollationID = 106
   194  	Collation_utf16_roman_ci              CollationID = 116
   195  	Collation_utf16_romanian_ci           CollationID = 104
   196  	Collation_utf16_sinhala_ci            CollationID = 120
   197  	Collation_utf16_slovak_ci             CollationID = 114
   198  	Collation_utf16_slovenian_ci          CollationID = 105
   199  	Collation_utf16_spanish2_ci           CollationID = 115
   200  	Collation_utf16_spanish_ci            CollationID = 108
   201  	Collation_utf16_swedish_ci            CollationID = 109
   202  	Collation_utf16_turkish_ci            CollationID = 110
   203  	Collation_utf16_unicode_520_ci        CollationID = 123
   204  	Collation_utf16_unicode_ci            CollationID = 101
   205  	Collation_utf16_vietnamese_ci         CollationID = 124
   206  	Collation_utf16le_bin                 CollationID = 62
   207  	Collation_utf16le_general_ci          CollationID = 56
   208  	Collation_utf32_bin                   CollationID = 61
   209  	Collation_utf32_croatian_ci           CollationID = 181
   210  	Collation_utf32_czech_ci              CollationID = 170
   211  	Collation_utf32_danish_ci             CollationID = 171
   212  	Collation_utf32_esperanto_ci          CollationID = 177
   213  	Collation_utf32_estonian_ci           CollationID = 166
   214  	Collation_utf32_general_ci            CollationID = 60
   215  	Collation_utf32_german2_ci            CollationID = 180
   216  	Collation_utf32_hungarian_ci          CollationID = 178
   217  	Collation_utf32_icelandic_ci          CollationID = 161
   218  	Collation_utf32_latvian_ci            CollationID = 162
   219  	Collation_utf32_lithuanian_ci         CollationID = 172
   220  	Collation_utf32_persian_ci            CollationID = 176
   221  	Collation_utf32_polish_ci             CollationID = 165
   222  	Collation_utf32_roman_ci              CollationID = 175
   223  	Collation_utf32_romanian_ci           CollationID = 163
   224  	Collation_utf32_sinhala_ci            CollationID = 179
   225  	Collation_utf32_slovak_ci             CollationID = 173
   226  	Collation_utf32_slovenian_ci          CollationID = 164
   227  	Collation_utf32_spanish2_ci           CollationID = 174
   228  	Collation_utf32_spanish_ci            CollationID = 167
   229  	Collation_utf32_swedish_ci            CollationID = 168
   230  	Collation_utf32_turkish_ci            CollationID = 169
   231  	Collation_utf32_unicode_520_ci        CollationID = 182
   232  	Collation_utf32_unicode_ci            CollationID = 160
   233  	Collation_utf32_vietnamese_ci         CollationID = 183
   234  	Collation_utf8mb3_bin                 CollationID = 83
   235  	Collation_utf8mb3_croatian_ci         CollationID = 213
   236  	Collation_utf8mb3_czech_ci            CollationID = 202
   237  	Collation_utf8mb3_danish_ci           CollationID = 203
   238  	Collation_utf8mb3_esperanto_ci        CollationID = 209
   239  	Collation_utf8mb3_estonian_ci         CollationID = 198
   240  	Collation_utf8mb3_general_ci          CollationID = 33
   241  	Collation_utf8mb3_general_mysql500_ci CollationID = 223
   242  	Collation_utf8mb3_german2_ci          CollationID = 212
   243  	Collation_utf8mb3_hungarian_ci        CollationID = 210
   244  	Collation_utf8mb3_icelandic_ci        CollationID = 193
   245  	Collation_utf8mb3_latvian_ci          CollationID = 194
   246  	Collation_utf8mb3_lithuanian_ci       CollationID = 204
   247  	Collation_utf8mb3_persian_ci          CollationID = 208
   248  	Collation_utf8mb3_polish_ci           CollationID = 197
   249  	Collation_utf8mb3_roman_ci            CollationID = 207
   250  	Collation_utf8mb3_romanian_ci         CollationID = 195
   251  	Collation_utf8mb3_sinhala_ci          CollationID = 211
   252  	Collation_utf8mb3_slovak_ci           CollationID = 205
   253  	Collation_utf8mb3_slovenian_ci        CollationID = 196
   254  	Collation_utf8mb3_spanish2_ci         CollationID = 206
   255  	Collation_utf8mb3_spanish_ci          CollationID = 199
   256  	Collation_utf8mb3_swedish_ci          CollationID = 200
   257  	Collation_utf8mb3_tolower_ci          CollationID = 76
   258  	Collation_utf8mb3_turkish_ci          CollationID = 201
   259  	Collation_utf8mb3_unicode_520_ci      CollationID = 214
   260  	Collation_utf8mb3_unicode_ci          CollationID = 192
   261  	Collation_utf8mb3_vietnamese_ci       CollationID = 215
   262  	Collation_utf8mb4_0900_ai_ci          CollationID = 255
   263  	Collation_utf8mb4_0900_as_ci          CollationID = 305
   264  	Collation_utf8mb4_0900_as_cs          CollationID = 278
   265  	Collation_utf8mb4_0900_bin            CollationID = 309
   266  	Collation_utf8mb4_bg_0900_ai_ci       CollationID = 318
   267  	Collation_utf8mb4_bg_0900_as_cs       CollationID = 319
   268  	Collation_utf8mb4_bin                 CollationID = 46
   269  	Collation_utf8mb4_bs_0900_ai_ci       CollationID = 316
   270  	Collation_utf8mb4_bs_0900_as_cs       CollationID = 317
   271  	Collation_utf8mb4_croatian_ci         CollationID = 245
   272  	Collation_utf8mb4_cs_0900_ai_ci       CollationID = 266
   273  	Collation_utf8mb4_cs_0900_as_cs       CollationID = 289
   274  	Collation_utf8mb4_czech_ci            CollationID = 234
   275  	Collation_utf8mb4_da_0900_ai_ci       CollationID = 267
   276  	Collation_utf8mb4_da_0900_as_cs       CollationID = 290
   277  	Collation_utf8mb4_danish_ci           CollationID = 235
   278  	Collation_utf8mb4_de_pb_0900_ai_ci    CollationID = 256
   279  	Collation_utf8mb4_de_pb_0900_as_cs    CollationID = 279
   280  	Collation_utf8mb4_eo_0900_ai_ci       CollationID = 273
   281  	Collation_utf8mb4_eo_0900_as_cs       CollationID = 296
   282  	Collation_utf8mb4_es_0900_ai_ci       CollationID = 263
   283  	Collation_utf8mb4_es_0900_as_cs       CollationID = 286
   284  	Collation_utf8mb4_es_trad_0900_ai_ci  CollationID = 270
   285  	Collation_utf8mb4_es_trad_0900_as_cs  CollationID = 293
   286  	Collation_utf8mb4_esperanto_ci        CollationID = 241
   287  	Collation_utf8mb4_estonian_ci         CollationID = 230
   288  	Collation_utf8mb4_et_0900_ai_ci       CollationID = 262
   289  	Collation_utf8mb4_et_0900_as_cs       CollationID = 285
   290  	Collation_utf8mb4_general_ci          CollationID = 45
   291  	Collation_utf8mb4_german2_ci          CollationID = 244
   292  	Collation_utf8mb4_gl_0900_ai_ci       CollationID = 320
   293  	Collation_utf8mb4_gl_0900_as_cs       CollationID = 321
   294  	Collation_utf8mb4_hr_0900_ai_ci       CollationID = 275
   295  	Collation_utf8mb4_hr_0900_as_cs       CollationID = 298
   296  	Collation_utf8mb4_hu_0900_ai_ci       CollationID = 274
   297  	Collation_utf8mb4_hu_0900_as_cs       CollationID = 297
   298  	Collation_utf8mb4_hungarian_ci        CollationID = 242
   299  	Collation_utf8mb4_icelandic_ci        CollationID = 225
   300  	Collation_utf8mb4_is_0900_ai_ci       CollationID = 257
   301  	Collation_utf8mb4_is_0900_as_cs       CollationID = 280
   302  	Collation_utf8mb4_ja_0900_as_cs       CollationID = 303
   303  	Collation_utf8mb4_ja_0900_as_cs_ks    CollationID = 304
   304  	Collation_utf8mb4_la_0900_ai_ci       CollationID = 271
   305  	Collation_utf8mb4_la_0900_as_cs       CollationID = 294
   306  	Collation_utf8mb4_latvian_ci          CollationID = 226
   307  	Collation_utf8mb4_lithuanian_ci       CollationID = 236
   308  	Collation_utf8mb4_lt_0900_ai_ci       CollationID = 268
   309  	Collation_utf8mb4_lt_0900_as_cs       CollationID = 291
   310  	Collation_utf8mb4_lv_0900_ai_ci       CollationID = 258
   311  	Collation_utf8mb4_lv_0900_as_cs       CollationID = 281
   312  	Collation_utf8mb4_mn_cyrl_0900_ai_ci  CollationID = 322
   313  	Collation_utf8mb4_mn_cyrl_0900_as_cs  CollationID = 323
   314  	Collation_utf8mb4_nb_0900_ai_ci       CollationID = 310
   315  	Collation_utf8mb4_nb_0900_as_cs       CollationID = 311
   316  	Collation_utf8mb4_nn_0900_ai_ci       CollationID = 312
   317  	Collation_utf8mb4_nn_0900_as_cs       CollationID = 313
   318  	Collation_utf8mb4_persian_ci          CollationID = 240
   319  	Collation_utf8mb4_pl_0900_ai_ci       CollationID = 261
   320  	Collation_utf8mb4_pl_0900_as_cs       CollationID = 284
   321  	Collation_utf8mb4_polish_ci           CollationID = 229
   322  	Collation_utf8mb4_ro_0900_ai_ci       CollationID = 259
   323  	Collation_utf8mb4_ro_0900_as_cs       CollationID = 282
   324  	Collation_utf8mb4_roman_ci            CollationID = 239
   325  	Collation_utf8mb4_romanian_ci         CollationID = 227
   326  	Collation_utf8mb4_ru_0900_ai_ci       CollationID = 306
   327  	Collation_utf8mb4_ru_0900_as_cs       CollationID = 307
   328  	Collation_utf8mb4_sinhala_ci          CollationID = 243
   329  	Collation_utf8mb4_sk_0900_ai_ci       CollationID = 269
   330  	Collation_utf8mb4_sk_0900_as_cs       CollationID = 292
   331  	Collation_utf8mb4_sl_0900_ai_ci       CollationID = 260
   332  	Collation_utf8mb4_sl_0900_as_cs       CollationID = 283
   333  	Collation_utf8mb4_slovak_ci           CollationID = 237
   334  	Collation_utf8mb4_slovenian_ci        CollationID = 228
   335  	Collation_utf8mb4_spanish2_ci         CollationID = 238
   336  	Collation_utf8mb4_spanish_ci          CollationID = 231
   337  	Collation_utf8mb4_sr_latn_0900_ai_ci  CollationID = 314
   338  	Collation_utf8mb4_sr_latn_0900_as_cs  CollationID = 315
   339  	Collation_utf8mb4_sv_0900_ai_ci       CollationID = 264
   340  	Collation_utf8mb4_sv_0900_as_cs       CollationID = 287
   341  	Collation_utf8mb4_swedish_ci          CollationID = 232
   342  	Collation_utf8mb4_tr_0900_ai_ci       CollationID = 265
   343  	Collation_utf8mb4_tr_0900_as_cs       CollationID = 288
   344  	Collation_utf8mb4_turkish_ci          CollationID = 233
   345  	Collation_utf8mb4_unicode_520_ci      CollationID = 246
   346  	Collation_utf8mb4_unicode_ci          CollationID = 224
   347  	Collation_utf8mb4_vi_0900_ai_ci       CollationID = 277
   348  	Collation_utf8mb4_vi_0900_as_cs       CollationID = 300
   349  	Collation_utf8mb4_vietnamese_ci       CollationID = 247
   350  	Collation_utf8mb4_zh_0900_as_cs       CollationID = 308
   351  
   352  	Collation_utf8_general_ci          = Collation_utf8mb3_general_ci
   353  	Collation_utf8_tolower_ci          = Collation_utf8mb3_tolower_ci
   354  	Collation_utf8_bin                 = Collation_utf8mb3_bin
   355  	Collation_utf8_unicode_ci          = Collation_utf8mb3_unicode_ci
   356  	Collation_utf8_icelandic_ci        = Collation_utf8mb3_icelandic_ci
   357  	Collation_utf8_latvian_ci          = Collation_utf8mb3_latvian_ci
   358  	Collation_utf8_romanian_ci         = Collation_utf8mb3_romanian_ci
   359  	Collation_utf8_slovenian_ci        = Collation_utf8mb3_slovenian_ci
   360  	Collation_utf8_polish_ci           = Collation_utf8mb3_polish_ci
   361  	Collation_utf8_estonian_ci         = Collation_utf8mb3_estonian_ci
   362  	Collation_utf8_spanish_ci          = Collation_utf8mb3_spanish_ci
   363  	Collation_utf8_swedish_ci          = Collation_utf8mb3_swedish_ci
   364  	Collation_utf8_turkish_ci          = Collation_utf8mb3_turkish_ci
   365  	Collation_utf8_czech_ci            = Collation_utf8mb3_czech_ci
   366  	Collation_utf8_danish_ci           = Collation_utf8mb3_danish_ci
   367  	Collation_utf8_lithuanian_ci       = Collation_utf8mb3_lithuanian_ci
   368  	Collation_utf8_slovak_ci           = Collation_utf8mb3_slovak_ci
   369  	Collation_utf8_spanish2_ci         = Collation_utf8mb3_spanish2_ci
   370  	Collation_utf8_roman_ci            = Collation_utf8mb3_roman_ci
   371  	Collation_utf8_persian_ci          = Collation_utf8mb3_persian_ci
   372  	Collation_utf8_esperanto_ci        = Collation_utf8mb3_esperanto_ci
   373  	Collation_utf8_hungarian_ci        = Collation_utf8mb3_hungarian_ci
   374  	Collation_utf8_sinhala_ci          = Collation_utf8mb3_sinhala_ci
   375  	Collation_utf8_german2_ci          = Collation_utf8mb3_german2_ci
   376  	Collation_utf8_croatian_ci         = Collation_utf8mb3_croatian_ci
   377  	Collation_utf8_unicode_520_ci      = Collation_utf8mb3_unicode_520_ci
   378  	Collation_utf8_vietnamese_ci       = Collation_utf8mb3_vietnamese_ci
   379  	Collation_utf8_general_mysql500_ci = Collation_utf8mb3_general_mysql500_ci
   380  
   381  	Collation_Default                    = Collation_utf8mb4_0900_bin
   382  	Collation_Information_Schema_Default = Collation_utf8mb3_general_ci
   383  	// Collation_Unspecified is used when a collation has not been specified, either explicitly or implicitly. This is
   384  	// usually used as an intermediate collation to be later replaced by an analyzer pass or a plan, although it is
   385  	// valid to use it directly. When used, behaves identically to the default collation, although it will NOT match
   386  	// the default collation.
   387  	Collation_Unspecified CollationID = 0
   388  )
   389  
   390  // collationArray contains the details of every collation, indexed by their ID. This allows for collations to be
   391  // efficiently passed around (since only an uint16 is needed), while still being able to quickly access all of their
   392  // properties (index lookups are significantly faster than map lookups). Not all IDs are used, which is why there are
   393  // gaps in the array.
   394  var collationArray = [324]Collation{
   395  	/*000*/ {Collation_Unspecified, "", CharacterSet_Unspecified, true, true, true, true, 0, "", nil},
   396  	/*001*/ {Collation_big5_chinese_ci, "big5_chinese_ci", CharacterSet_big5, true, true, false, true, 1, "PAD SPACE", nil},
   397  	/*002*/ {Collation_latin2_czech_cs, "latin2_czech_cs", CharacterSet_latin2, false, true, true, true, 4, "PAD SPACE", nil},
   398  	/*003*/ {Collation_dec8_swedish_ci, "dec8_swedish_ci", CharacterSet_dec8, true, true, false, true, 1, "PAD SPACE", encodings.Dec8_swedish_ci_RuneWeight},
   399  	/*004*/ {Collation_cp850_general_ci, "cp850_general_ci", CharacterSet_cp850, true, true, false, true, 1, "PAD SPACE", nil},
   400  	/*005*/ {Collation_latin1_german1_ci, "latin1_german1_ci", CharacterSet_latin1, false, true, false, true, 1, "PAD SPACE", encodings.Latin1_german1_ci_RuneWeight},
   401  	/*006*/ {Collation_hp8_english_ci, "hp8_english_ci", CharacterSet_hp8, true, true, false, true, 1, "PAD SPACE", nil},
   402  	/*007*/ {Collation_koi8r_general_ci, "koi8r_general_ci", CharacterSet_koi8r, true, true, false, true, 1, "PAD SPACE", nil},
   403  	/*008*/ {Collation_latin1_swedish_ci, "latin1_swedish_ci", CharacterSet_latin1, true, true, false, true, 1, "PAD SPACE", encodings.Latin1_swedish_ci_RuneWeight},
   404  	/*009*/ {Collation_latin2_general_ci, "latin2_general_ci", CharacterSet_latin2, true, true, false, true, 1, "PAD SPACE", nil},
   405  	/*010*/ {Collation_swe7_swedish_ci, "swe7_swedish_ci", CharacterSet_swe7, true, true, false, true, 1, "PAD SPACE", encodings.Swe7_swedish_ci_RuneWeight},
   406  	/*011*/ {Collation_ascii_general_ci, "ascii_general_ci", CharacterSet_ascii, true, true, false, true, 1, "PAD SPACE", encodings.Ascii_general_ci_RuneWeight},
   407  	/*012*/ {Collation_ujis_japanese_ci, "ujis_japanese_ci", CharacterSet_ujis, true, true, false, true, 1, "PAD SPACE", nil},
   408  	/*013*/ {Collation_sjis_japanese_ci, "sjis_japanese_ci", CharacterSet_sjis, true, true, false, true, 1, "PAD SPACE", nil},
   409  	/*014*/ {Collation_cp1251_bulgarian_ci, "cp1251_bulgarian_ci", CharacterSet_cp1251, false, true, false, true, 1, "PAD SPACE", nil},
   410  	/*015*/ {Collation_latin1_danish_ci, "latin1_danish_ci", CharacterSet_latin1, false, true, false, true, 1, "PAD SPACE", encodings.Latin1_danish_ci_RuneWeight},
   411  	/*016*/ {Collation_hebrew_general_ci, "hebrew_general_ci", CharacterSet_hebrew, true, true, false, true, 1, "PAD SPACE", nil},
   412  	/*017*/ {},
   413  	/*018*/ {Collation_tis620_thai_ci, "tis620_thai_ci", CharacterSet_tis620, true, true, false, true, 4, "PAD SPACE", nil},
   414  	/*019*/ {Collation_euckr_korean_ci, "euckr_korean_ci", CharacterSet_euckr, true, true, false, true, 1, "PAD SPACE", nil},
   415  	/*020*/ {Collation_latin7_estonian_cs, "latin7_estonian_cs", CharacterSet_latin7, false, true, true, true, 1, "PAD SPACE", encodings.Latin7_estonian_cs_RuneWeight},
   416  	/*021*/ {Collation_latin2_hungarian_ci, "latin2_hungarian_ci", CharacterSet_latin2, false, true, false, true, 1, "PAD SPACE", nil},
   417  	/*022*/ {Collation_koi8u_general_ci, "koi8u_general_ci", CharacterSet_koi8u, true, true, false, true, 1, "PAD SPACE", nil},
   418  	/*023*/ {Collation_cp1251_ukrainian_ci, "cp1251_ukrainian_ci", CharacterSet_cp1251, false, true, false, true, 1, "PAD SPACE", nil},
   419  	/*024*/ {Collation_gb2312_chinese_ci, "gb2312_chinese_ci", CharacterSet_gb2312, true, true, false, true, 1, "PAD SPACE", nil},
   420  	/*025*/ {Collation_greek_general_ci, "greek_general_ci", CharacterSet_greek, true, true, false, true, 1, "PAD SPACE", nil},
   421  	/*026*/ {Collation_cp1250_general_ci, "cp1250_general_ci", CharacterSet_cp1250, true, true, false, true, 1, "PAD SPACE", nil},
   422  	/*027*/ {Collation_latin2_croatian_ci, "latin2_croatian_ci", CharacterSet_latin2, false, true, false, true, 1, "PAD SPACE", nil},
   423  	/*028*/ {Collation_gbk_chinese_ci, "gbk_chinese_ci", CharacterSet_gbk, true, true, false, true, 1, "PAD SPACE", nil},
   424  	/*029*/ {Collation_cp1257_lithuanian_ci, "cp1257_lithuanian_ci", CharacterSet_cp1257, false, true, false, true, 1, "PAD SPACE", encodings.Cp1257_lithuanian_ci_RuneWeight},
   425  	/*030*/ {Collation_latin5_turkish_ci, "latin5_turkish_ci", CharacterSet_latin5, true, true, false, true, 1, "PAD SPACE", nil},
   426  	/*031*/ {Collation_latin1_german2_ci, "latin1_german2_ci", CharacterSet_latin1, false, true, false, true, 2, "PAD SPACE", encodings.Latin1_german2_ci_RuneWeight},
   427  	/*032*/ {Collation_armscii8_general_ci, "armscii8_general_ci", CharacterSet_armscii8, true, true, false, true, 1, "PAD SPACE", nil},
   428  	/*033*/ {Collation_utf8mb3_general_ci, "utf8mb3_general_ci", CharacterSet_utf8mb3, true, true, false, true, 1, "PAD SPACE", encodings.Utf8mb3_general_ci_RuneWeight},
   429  	/*034*/ {Collation_cp1250_czech_cs, "cp1250_czech_cs", CharacterSet_cp1250, false, true, true, true, 2, "PAD SPACE", nil},
   430  	/*035*/ {Collation_ucs2_general_ci, "ucs2_general_ci", CharacterSet_ucs2, true, true, false, true, 1, "PAD SPACE", nil},
   431  	/*036*/ {Collation_cp866_general_ci, "cp866_general_ci", CharacterSet_cp866, true, true, false, true, 1, "PAD SPACE", nil},
   432  	/*037*/ {Collation_keybcs2_general_ci, "keybcs2_general_ci", CharacterSet_keybcs2, true, true, false, true, 1, "PAD SPACE", nil},
   433  	/*038*/ {Collation_macce_general_ci, "macce_general_ci", CharacterSet_macce, true, true, false, true, 1, "PAD SPACE", nil},
   434  	/*039*/ {Collation_macroman_general_ci, "macroman_general_ci", CharacterSet_macroman, true, true, false, true, 1, "PAD SPACE", nil},
   435  	/*040*/ {Collation_cp852_general_ci, "cp852_general_ci", CharacterSet_cp852, true, true, false, true, 1, "PAD SPACE", nil},
   436  	/*041*/ {Collation_latin7_general_ci, "latin7_general_ci", CharacterSet_latin7, true, true, false, true, 1, "PAD SPACE", encodings.Latin7_general_ci_RuneWeight},
   437  	/*042*/ {Collation_latin7_general_cs, "latin7_general_cs", CharacterSet_latin7, false, true, true, true, 1, "PAD SPACE", encodings.Latin7_general_cs_RuneWeight},
   438  	/*043*/ {Collation_macce_bin, "macce_bin", CharacterSet_macce, false, true, true, true, 1, "PAD SPACE", nil},
   439  	/*044*/ {Collation_cp1250_croatian_ci, "cp1250_croatian_ci", CharacterSet_cp1250, false, true, false, true, 1, "PAD SPACE", nil},
   440  	/*045*/ {Collation_utf8mb4_general_ci, "utf8mb4_general_ci", CharacterSet_utf8mb4, false, true, false, true, 1, "PAD SPACE", encodings.Utf8mb4_general_ci_RuneWeight},
   441  	/*046*/ {Collation_utf8mb4_bin, "utf8mb4_bin", CharacterSet_utf8mb4, false, true, true, true, 1, "PAD SPACE", encodings.Utf8mb4_bin_RuneWeight},
   442  	/*047*/ {Collation_latin1_bin, "latin1_bin", CharacterSet_latin1, false, true, true, true, 1, "PAD SPACE", encodings.Latin1_bin_RuneWeight},
   443  	/*048*/ {Collation_latin1_general_ci, "latin1_general_ci", CharacterSet_latin1, false, true, false, true, 1, "PAD SPACE", encodings.Latin1_general_ci_RuneWeight},
   444  	/*049*/ {Collation_latin1_general_cs, "latin1_general_cs", CharacterSet_latin1, false, true, true, true, 1, "PAD SPACE", encodings.Latin1_general_cs_RuneWeight},
   445  	/*050*/ {Collation_cp1251_bin, "cp1251_bin", CharacterSet_cp1251, false, true, true, true, 1, "PAD SPACE", nil},
   446  	/*051*/ {Collation_cp1251_general_ci, "cp1251_general_ci", CharacterSet_cp1251, true, true, false, true, 1, "PAD SPACE", nil},
   447  	/*052*/ {Collation_cp1251_general_cs, "cp1251_general_cs", CharacterSet_cp1251, false, true, true, true, 1, "PAD SPACE", nil},
   448  	/*053*/ {Collation_macroman_bin, "macroman_bin", CharacterSet_macroman, false, true, true, true, 1, "PAD SPACE", nil},
   449  	/*054*/ {Collation_utf16_general_ci, "utf16_general_ci", CharacterSet_utf16, true, true, false, true, 1, "PAD SPACE", encodings.Utf16_general_ci_RuneWeight},
   450  	/*055*/ {Collation_utf16_bin, "utf16_bin", CharacterSet_utf16, false, true, true, true, 1, "PAD SPACE", encodings.Utf16_bin_RuneWeight},
   451  	/*056*/ {Collation_utf16le_general_ci, "utf16le_general_ci", CharacterSet_utf16le, true, true, false, true, 1, "PAD SPACE", nil},
   452  	/*057*/ {Collation_cp1256_general_ci, "cp1256_general_ci", CharacterSet_cp1256, true, true, false, true, 1, "PAD SPACE", encodings.Cp1256_general_ci_RuneWeight},
   453  	/*058*/ {Collation_cp1257_bin, "cp1257_bin", CharacterSet_cp1257, false, true, true, true, 1, "PAD SPACE", encodings.Cp1257_bin_RuneWeight},
   454  	/*059*/ {Collation_cp1257_general_ci, "cp1257_general_ci", CharacterSet_cp1257, true, true, false, true, 1, "PAD SPACE", encodings.Cp1257_general_ci_RuneWeight},
   455  	/*060*/ {Collation_utf32_general_ci, "utf32_general_ci", CharacterSet_utf32, true, true, false, true, 1, "PAD SPACE", encodings.Utf32_general_ci_RuneWeight},
   456  	/*061*/ {Collation_utf32_bin, "utf32_bin", CharacterSet_utf32, false, true, true, true, 1, "PAD SPACE", encodings.Utf32_bin_RuneWeight},
   457  	/*062*/ {Collation_utf16le_bin, "utf16le_bin", CharacterSet_utf16le, false, true, true, true, 1, "PAD SPACE", nil},
   458  	/*063*/ {Collation_binary, "binary", CharacterSet_binary, true, true, true, true, 1, "NO PAD", encodings.Binary_RuneWeight},
   459  	/*064*/ {Collation_armscii8_bin, "armscii8_bin", CharacterSet_armscii8, false, true, true, true, 1, "PAD SPACE", nil},
   460  	/*065*/ {Collation_ascii_bin, "ascii_bin", CharacterSet_ascii, false, true, true, true, 1, "PAD SPACE", encodings.Ascii_bin_RuneWeight},
   461  	/*066*/ {Collation_cp1250_bin, "cp1250_bin", CharacterSet_cp1250, false, true, true, true, 1, "PAD SPACE", nil},
   462  	/*067*/ {Collation_cp1256_bin, "cp1256_bin", CharacterSet_cp1256, false, true, true, true, 1, "PAD SPACE", encodings.Cp1256_bin_RuneWeight},
   463  	/*068*/ {Collation_cp866_bin, "cp866_bin", CharacterSet_cp866, false, true, true, true, 1, "PAD SPACE", nil},
   464  	/*069*/ {Collation_dec8_bin, "dec8_bin", CharacterSet_dec8, false, true, true, true, 1, "PAD SPACE", encodings.Dec8_bin_RuneWeight},
   465  	/*070*/ {Collation_greek_bin, "greek_bin", CharacterSet_greek, false, true, true, true, 1, "PAD SPACE", nil},
   466  	/*071*/ {Collation_hebrew_bin, "hebrew_bin", CharacterSet_hebrew, false, true, true, true, 1, "PAD SPACE", nil},
   467  	/*072*/ {Collation_hp8_bin, "hp8_bin", CharacterSet_hp8, false, true, true, true, 1, "PAD SPACE", nil},
   468  	/*073*/ {Collation_keybcs2_bin, "keybcs2_bin", CharacterSet_keybcs2, false, true, true, true, 1, "PAD SPACE", nil},
   469  	/*074*/ {Collation_koi8r_bin, "koi8r_bin", CharacterSet_koi8r, false, true, true, true, 1, "PAD SPACE", nil},
   470  	/*075*/ {Collation_koi8u_bin, "koi8u_bin", CharacterSet_koi8u, false, true, true, true, 1, "PAD SPACE", nil},
   471  	/*076*/ {Collation_utf8mb3_tolower_ci, "utf8mb3_tolower_ci", CharacterSet_utf8mb3, false, true, false, true, 1, "PAD SPACE", encodings.Utf8mb3_tolower_ci_RuneWeight},
   472  	/*077*/ {Collation_latin2_bin, "latin2_bin", CharacterSet_latin2, false, true, true, true, 1, "PAD SPACE", nil},
   473  	/*078*/ {Collation_latin5_bin, "latin5_bin", CharacterSet_latin5, false, true, true, true, 1, "PAD SPACE", nil},
   474  	/*079*/ {Collation_latin7_bin, "latin7_bin", CharacterSet_latin7, false, true, true, true, 1, "PAD SPACE", encodings.Latin7_bin_RuneWeight},
   475  	/*080*/ {Collation_cp850_bin, "cp850_bin", CharacterSet_cp850, false, true, true, true, 1, "PAD SPACE", nil},
   476  	/*081*/ {Collation_cp852_bin, "cp852_bin", CharacterSet_cp852, false, true, true, true, 1, "PAD SPACE", nil},
   477  	/*082*/ {Collation_swe7_bin, "swe7_bin", CharacterSet_swe7, false, true, true, true, 1, "PAD SPACE", encodings.Swe7_bin_RuneWeight},
   478  	/*083*/ {Collation_utf8mb3_bin, "utf8mb3_bin", CharacterSet_utf8mb3, false, true, true, true, 1, "PAD SPACE", encodings.Utf8mb3_bin_RuneWeight},
   479  	/*084*/ {Collation_big5_bin, "big5_bin", CharacterSet_big5, false, true, true, true, 1, "PAD SPACE", nil},
   480  	/*085*/ {Collation_euckr_bin, "euckr_bin", CharacterSet_euckr, false, true, true, true, 1, "PAD SPACE", nil},
   481  	/*086*/ {Collation_gb2312_bin, "gb2312_bin", CharacterSet_gb2312, false, true, true, true, 1, "PAD SPACE", nil},
   482  	/*087*/ {Collation_gbk_bin, "gbk_bin", CharacterSet_gbk, false, true, true, true, 1, "PAD SPACE", nil},
   483  	/*088*/ {Collation_sjis_bin, "sjis_bin", CharacterSet_sjis, false, true, true, true, 1, "PAD SPACE", nil},
   484  	/*089*/ {Collation_tis620_bin, "tis620_bin", CharacterSet_tis620, false, true, true, true, 1, "PAD SPACE", nil},
   485  	/*090*/ {Collation_ucs2_bin, "ucs2_bin", CharacterSet_ucs2, false, true, true, true, 1, "PAD SPACE", nil},
   486  	/*091*/ {Collation_ujis_bin, "ujis_bin", CharacterSet_ujis, false, true, true, true, 1, "PAD SPACE", nil},
   487  	/*092*/ {Collation_geostd8_general_ci, "geostd8_general_ci", CharacterSet_geostd8, true, true, false, true, 1, "PAD SPACE", encodings.Geostd8_general_ci_RuneWeight},
   488  	/*093*/ {Collation_geostd8_bin, "geostd8_bin", CharacterSet_geostd8, false, true, true, true, 1, "PAD SPACE", encodings.Geostd8_bin_RuneWeight},
   489  	/*094*/ {Collation_latin1_spanish_ci, "latin1_spanish_ci", CharacterSet_latin1, false, true, false, true, 1, "PAD SPACE", encodings.Latin1_spanish_ci_RuneWeight},
   490  	/*095*/ {Collation_cp932_japanese_ci, "cp932_japanese_ci", CharacterSet_cp932, true, true, false, true, 1, "PAD SPACE", nil},
   491  	/*096*/ {Collation_cp932_bin, "cp932_bin", CharacterSet_cp932, false, true, true, true, 1, "PAD SPACE", nil},
   492  	/*097*/ {Collation_eucjpms_japanese_ci, "eucjpms_japanese_ci", CharacterSet_eucjpms, true, true, false, true, 1, "PAD SPACE", nil},
   493  	/*098*/ {Collation_eucjpms_bin, "eucjpms_bin", CharacterSet_eucjpms, false, true, true, true, 1, "PAD SPACE", nil},
   494  	/*099*/ {Collation_cp1250_polish_ci, "cp1250_polish_ci", CharacterSet_cp1250, false, true, false, true, 1, "PAD SPACE", nil},
   495  	/*100*/ {},
   496  	/*101*/ {Collation_utf16_unicode_ci, "utf16_unicode_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_unicode_ci_RuneWeight},
   497  	/*102*/ {Collation_utf16_icelandic_ci, "utf16_icelandic_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_icelandic_ci_RuneWeight},
   498  	/*103*/ {Collation_utf16_latvian_ci, "utf16_latvian_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_latvian_ci_RuneWeight},
   499  	/*104*/ {Collation_utf16_romanian_ci, "utf16_romanian_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_romanian_ci_RuneWeight},
   500  	/*105*/ {Collation_utf16_slovenian_ci, "utf16_slovenian_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_slovenian_ci_RuneWeight},
   501  	/*106*/ {Collation_utf16_polish_ci, "utf16_polish_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_polish_ci_RuneWeight},
   502  	/*107*/ {Collation_utf16_estonian_ci, "utf16_estonian_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_estonian_ci_RuneWeight},
   503  	/*108*/ {Collation_utf16_spanish_ci, "utf16_spanish_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_spanish_ci_RuneWeight},
   504  	/*109*/ {Collation_utf16_swedish_ci, "utf16_swedish_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_swedish_ci_RuneWeight},
   505  	/*110*/ {Collation_utf16_turkish_ci, "utf16_turkish_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_turkish_ci_RuneWeight},
   506  	/*111*/ {Collation_utf16_czech_ci, "utf16_czech_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_czech_ci_RuneWeight},
   507  	/*112*/ {Collation_utf16_danish_ci, "utf16_danish_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_danish_ci_RuneWeight},
   508  	/*113*/ {Collation_utf16_lithuanian_ci, "utf16_lithuanian_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_lithuanian_ci_RuneWeight},
   509  	/*114*/ {Collation_utf16_slovak_ci, "utf16_slovak_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_slovak_ci_RuneWeight},
   510  	/*115*/ {Collation_utf16_spanish2_ci, "utf16_spanish2_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_spanish2_ci_RuneWeight},
   511  	/*116*/ {Collation_utf16_roman_ci, "utf16_roman_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_roman_ci_RuneWeight},
   512  	/*117*/ {Collation_utf16_persian_ci, "utf16_persian_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_persian_ci_RuneWeight},
   513  	/*118*/ {Collation_utf16_esperanto_ci, "utf16_esperanto_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_esperanto_ci_RuneWeight},
   514  	/*119*/ {Collation_utf16_hungarian_ci, "utf16_hungarian_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_hungarian_ci_RuneWeight},
   515  	/*120*/ {Collation_utf16_sinhala_ci, "utf16_sinhala_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_sinhala_ci_RuneWeight},
   516  	/*121*/ {Collation_utf16_german2_ci, "utf16_german2_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_german2_ci_RuneWeight},
   517  	/*122*/ {Collation_utf16_croatian_ci, "utf16_croatian_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_croatian_ci_RuneWeight},
   518  	/*123*/ {Collation_utf16_unicode_520_ci, "utf16_unicode_520_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_unicode_520_ci_RuneWeight},
   519  	/*124*/ {Collation_utf16_vietnamese_ci, "utf16_vietnamese_ci", CharacterSet_utf16, false, true, false, true, 8, "PAD SPACE", encodings.Utf16_vietnamese_ci_RuneWeight},
   520  	/*125*/ {},
   521  	/*126*/ {},
   522  	/*127*/ {},
   523  	/*128*/ {Collation_ucs2_unicode_ci, "ucs2_unicode_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   524  	/*129*/ {Collation_ucs2_icelandic_ci, "ucs2_icelandic_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   525  	/*130*/ {Collation_ucs2_latvian_ci, "ucs2_latvian_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   526  	/*131*/ {Collation_ucs2_romanian_ci, "ucs2_romanian_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   527  	/*132*/ {Collation_ucs2_slovenian_ci, "ucs2_slovenian_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   528  	/*133*/ {Collation_ucs2_polish_ci, "ucs2_polish_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   529  	/*134*/ {Collation_ucs2_estonian_ci, "ucs2_estonian_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   530  	/*135*/ {Collation_ucs2_spanish_ci, "ucs2_spanish_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   531  	/*136*/ {Collation_ucs2_swedish_ci, "ucs2_swedish_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   532  	/*137*/ {Collation_ucs2_turkish_ci, "ucs2_turkish_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   533  	/*138*/ {Collation_ucs2_czech_ci, "ucs2_czech_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   534  	/*139*/ {Collation_ucs2_danish_ci, "ucs2_danish_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   535  	/*140*/ {Collation_ucs2_lithuanian_ci, "ucs2_lithuanian_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   536  	/*141*/ {Collation_ucs2_slovak_ci, "ucs2_slovak_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   537  	/*142*/ {Collation_ucs2_spanish2_ci, "ucs2_spanish2_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   538  	/*143*/ {Collation_ucs2_roman_ci, "ucs2_roman_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   539  	/*144*/ {Collation_ucs2_persian_ci, "ucs2_persian_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   540  	/*145*/ {Collation_ucs2_esperanto_ci, "ucs2_esperanto_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   541  	/*146*/ {Collation_ucs2_hungarian_ci, "ucs2_hungarian_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   542  	/*147*/ {Collation_ucs2_sinhala_ci, "ucs2_sinhala_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   543  	/*148*/ {Collation_ucs2_german2_ci, "ucs2_german2_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   544  	/*149*/ {Collation_ucs2_croatian_ci, "ucs2_croatian_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   545  	/*150*/ {Collation_ucs2_unicode_520_ci, "ucs2_unicode_520_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   546  	/*151*/ {Collation_ucs2_vietnamese_ci, "ucs2_vietnamese_ci", CharacterSet_ucs2, false, true, false, true, 8, "PAD SPACE", nil},
   547  	/*152*/ {},
   548  	/*153*/ {},
   549  	/*154*/ {},
   550  	/*155*/ {},
   551  	/*156*/ {},
   552  	/*157*/ {},
   553  	/*158*/ {},
   554  	/*159*/ {Collation_ucs2_general_mysql500_ci, "ucs2_general_mysql500_ci", CharacterSet_ucs2, false, true, false, true, 1, "PAD SPACE", nil},
   555  	/*160*/ {Collation_utf32_unicode_ci, "utf32_unicode_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_unicode_ci_RuneWeight},
   556  	/*161*/ {Collation_utf32_icelandic_ci, "utf32_icelandic_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_icelandic_ci_RuneWeight},
   557  	/*162*/ {Collation_utf32_latvian_ci, "utf32_latvian_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_latvian_ci_RuneWeight},
   558  	/*163*/ {Collation_utf32_romanian_ci, "utf32_romanian_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_romanian_ci_RuneWeight},
   559  	/*164*/ {Collation_utf32_slovenian_ci, "utf32_slovenian_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_slovenian_ci_RuneWeight},
   560  	/*165*/ {Collation_utf32_polish_ci, "utf32_polish_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_polish_ci_RuneWeight},
   561  	/*166*/ {Collation_utf32_estonian_ci, "utf32_estonian_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_estonian_ci_RuneWeight},
   562  	/*167*/ {Collation_utf32_spanish_ci, "utf32_spanish_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_spanish_ci_RuneWeight},
   563  	/*168*/ {Collation_utf32_swedish_ci, "utf32_swedish_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_swedish_ci_RuneWeight},
   564  	/*169*/ {Collation_utf32_turkish_ci, "utf32_turkish_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_turkish_ci_RuneWeight},
   565  	/*170*/ {Collation_utf32_czech_ci, "utf32_czech_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_czech_ci_RuneWeight},
   566  	/*171*/ {Collation_utf32_danish_ci, "utf32_danish_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_danish_ci_RuneWeight},
   567  	/*172*/ {Collation_utf32_lithuanian_ci, "utf32_lithuanian_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_lithuanian_ci_RuneWeight},
   568  	/*173*/ {Collation_utf32_slovak_ci, "utf32_slovak_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_slovak_ci_RuneWeight},
   569  	/*174*/ {Collation_utf32_spanish2_ci, "utf32_spanish2_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_spanish2_ci_RuneWeight},
   570  	/*175*/ {Collation_utf32_roman_ci, "utf32_roman_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_roman_ci_RuneWeight},
   571  	/*176*/ {Collation_utf32_persian_ci, "utf32_persian_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_persian_ci_RuneWeight},
   572  	/*177*/ {Collation_utf32_esperanto_ci, "utf32_esperanto_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_esperanto_ci_RuneWeight},
   573  	/*178*/ {Collation_utf32_hungarian_ci, "utf32_hungarian_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_hungarian_ci_RuneWeight},
   574  	/*179*/ {Collation_utf32_sinhala_ci, "utf32_sinhala_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_sinhala_ci_RuneWeight},
   575  	/*180*/ {Collation_utf32_german2_ci, "utf32_german2_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_german2_ci_RuneWeight},
   576  	/*181*/ {Collation_utf32_croatian_ci, "utf32_croatian_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_croatian_ci_RuneWeight},
   577  	/*182*/ {Collation_utf32_unicode_520_ci, "utf32_unicode_520_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_unicode_520_ci_RuneWeight},
   578  	/*183*/ {Collation_utf32_vietnamese_ci, "utf32_vietnamese_ci", CharacterSet_utf32, false, true, false, true, 8, "PAD SPACE", encodings.Utf32_vietnamese_ci_RuneWeight},
   579  	/*184*/ {},
   580  	/*185*/ {},
   581  	/*186*/ {},
   582  	/*187*/ {},
   583  	/*188*/ {},
   584  	/*189*/ {},
   585  	/*190*/ {},
   586  	/*191*/ {},
   587  	/*192*/ {Collation_utf8mb3_unicode_ci, "utf8mb3_unicode_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_unicode_ci_RuneWeight},
   588  	/*193*/ {Collation_utf8mb3_icelandic_ci, "utf8mb3_icelandic_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_icelandic_ci_RuneWeight},
   589  	/*194*/ {Collation_utf8mb3_latvian_ci, "utf8mb3_latvian_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_latvian_ci_RuneWeight},
   590  	/*195*/ {Collation_utf8mb3_romanian_ci, "utf8mb3_romanian_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_romanian_ci_RuneWeight},
   591  	/*196*/ {Collation_utf8mb3_slovenian_ci, "utf8mb3_slovenian_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_slovenian_ci_RuneWeight},
   592  	/*197*/ {Collation_utf8mb3_polish_ci, "utf8mb3_polish_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_polish_ci_RuneWeight},
   593  	/*198*/ {Collation_utf8mb3_estonian_ci, "utf8mb3_estonian_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_estonian_ci_RuneWeight},
   594  	/*199*/ {Collation_utf8mb3_spanish_ci, "utf8mb3_spanish_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_spanish_ci_RuneWeight},
   595  	/*200*/ {Collation_utf8mb3_swedish_ci, "utf8mb3_swedish_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_swedish_ci_RuneWeight},
   596  	/*201*/ {Collation_utf8mb3_turkish_ci, "utf8mb3_turkish_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_turkish_ci_RuneWeight},
   597  	/*202*/ {Collation_utf8mb3_czech_ci, "utf8mb3_czech_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_czech_ci_RuneWeight},
   598  	/*203*/ {Collation_utf8mb3_danish_ci, "utf8mb3_danish_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_danish_ci_RuneWeight},
   599  	/*204*/ {Collation_utf8mb3_lithuanian_ci, "utf8mb3_lithuanian_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_lithuanian_ci_RuneWeight},
   600  	/*205*/ {Collation_utf8mb3_slovak_ci, "utf8mb3_slovak_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_slovak_ci_RuneWeight},
   601  	/*206*/ {Collation_utf8mb3_spanish2_ci, "utf8mb3_spanish2_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_spanish2_ci_RuneWeight},
   602  	/*207*/ {Collation_utf8mb3_roman_ci, "utf8mb3_roman_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_roman_ci_RuneWeight},
   603  	/*208*/ {Collation_utf8mb3_persian_ci, "utf8mb3_persian_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_persian_ci_RuneWeight},
   604  	/*209*/ {Collation_utf8mb3_esperanto_ci, "utf8mb3_esperanto_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_esperanto_ci_RuneWeight},
   605  	/*210*/ {Collation_utf8mb3_hungarian_ci, "utf8mb3_hungarian_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_hungarian_ci_RuneWeight},
   606  	/*211*/ {Collation_utf8mb3_sinhala_ci, "utf8mb3_sinhala_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_sinhala_ci_RuneWeight},
   607  	/*212*/ {Collation_utf8mb3_german2_ci, "utf8mb3_german2_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_german2_ci_RuneWeight},
   608  	/*213*/ {Collation_utf8mb3_croatian_ci, "utf8mb3_croatian_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_croatian_ci_RuneWeight},
   609  	/*214*/ {Collation_utf8mb3_unicode_520_ci, "utf8mb3_unicode_520_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_unicode_520_ci_RuneWeight},
   610  	/*215*/ {Collation_utf8mb3_vietnamese_ci, "utf8mb3_vietnamese_ci", CharacterSet_utf8mb3, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb3_vietnamese_ci_RuneWeight},
   611  	/*216*/ {},
   612  	/*217*/ {},
   613  	/*218*/ {},
   614  	/*219*/ {},
   615  	/*220*/ {},
   616  	/*221*/ {},
   617  	/*222*/ {},
   618  	/*223*/ {Collation_utf8mb3_general_mysql500_ci, "utf8mb3_general_mysql500_ci", CharacterSet_utf8mb3, false, true, false, true, 1, "PAD SPACE", encodings.Utf8mb3_general_mysql500_ci_RuneWeight},
   619  	/*224*/ {Collation_utf8mb4_unicode_ci, "utf8mb4_unicode_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_unicode_ci_RuneWeight},
   620  	/*225*/ {Collation_utf8mb4_icelandic_ci, "utf8mb4_icelandic_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_icelandic_ci_RuneWeight},
   621  	/*226*/ {Collation_utf8mb4_latvian_ci, "utf8mb4_latvian_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_latvian_ci_RuneWeight},
   622  	/*227*/ {Collation_utf8mb4_romanian_ci, "utf8mb4_romanian_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_romanian_ci_RuneWeight},
   623  	/*228*/ {Collation_utf8mb4_slovenian_ci, "utf8mb4_slovenian_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_slovenian_ci_RuneWeight},
   624  	/*229*/ {Collation_utf8mb4_polish_ci, "utf8mb4_polish_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_polish_ci_RuneWeight},
   625  	/*230*/ {Collation_utf8mb4_estonian_ci, "utf8mb4_estonian_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_estonian_ci_RuneWeight},
   626  	/*231*/ {Collation_utf8mb4_spanish_ci, "utf8mb4_spanish_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_spanish_ci_RuneWeight},
   627  	/*232*/ {Collation_utf8mb4_swedish_ci, "utf8mb4_swedish_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_swedish_ci_RuneWeight},
   628  	/*233*/ {Collation_utf8mb4_turkish_ci, "utf8mb4_turkish_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_turkish_ci_RuneWeight},
   629  	/*234*/ {Collation_utf8mb4_czech_ci, "utf8mb4_czech_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_czech_ci_RuneWeight},
   630  	/*235*/ {Collation_utf8mb4_danish_ci, "utf8mb4_danish_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_danish_ci_RuneWeight},
   631  	/*236*/ {Collation_utf8mb4_lithuanian_ci, "utf8mb4_lithuanian_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_lithuanian_ci_RuneWeight},
   632  	/*237*/ {Collation_utf8mb4_slovak_ci, "utf8mb4_slovak_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_slovak_ci_RuneWeight},
   633  	/*238*/ {Collation_utf8mb4_spanish2_ci, "utf8mb4_spanish2_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_spanish2_ci_RuneWeight},
   634  	/*239*/ {Collation_utf8mb4_roman_ci, "utf8mb4_roman_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_roman_ci_RuneWeight},
   635  	/*240*/ {Collation_utf8mb4_persian_ci, "utf8mb4_persian_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_persian_ci_RuneWeight},
   636  	/*241*/ {Collation_utf8mb4_esperanto_ci, "utf8mb4_esperanto_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_esperanto_ci_RuneWeight},
   637  	/*242*/ {Collation_utf8mb4_hungarian_ci, "utf8mb4_hungarian_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_hungarian_ci_RuneWeight},
   638  	/*243*/ {Collation_utf8mb4_sinhala_ci, "utf8mb4_sinhala_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_sinhala_ci_RuneWeight},
   639  	/*244*/ {Collation_utf8mb4_german2_ci, "utf8mb4_german2_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_german2_ci_RuneWeight},
   640  	/*245*/ {Collation_utf8mb4_croatian_ci, "utf8mb4_croatian_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_croatian_ci_RuneWeight},
   641  	/*246*/ {Collation_utf8mb4_unicode_520_ci, "utf8mb4_unicode_520_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_unicode_520_ci_RuneWeight},
   642  	/*247*/ {Collation_utf8mb4_vietnamese_ci, "utf8mb4_vietnamese_ci", CharacterSet_utf8mb4, false, true, false, true, 8, "PAD SPACE", encodings.Utf8mb4_vietnamese_ci_RuneWeight},
   643  	/*248*/ {Collation_gb18030_chinese_ci, "gb18030_chinese_ci", CharacterSet_gb18030, true, true, false, true, 2, "PAD SPACE", nil},
   644  	/*249*/ {Collation_gb18030_bin, "gb18030_bin", CharacterSet_gb18030, false, true, true, true, 1, "PAD SPACE", nil},
   645  	/*250*/ {Collation_gb18030_unicode_520_ci, "gb18030_unicode_520_ci", CharacterSet_gb18030, false, true, false, true, 8, "PAD SPACE", nil},
   646  	/*251*/ {},
   647  	/*252*/ {},
   648  	/*253*/ {},
   649  	/*254*/ {},
   650  	/*255*/ {Collation_utf8mb4_0900_ai_ci, "utf8mb4_0900_ai_ci", CharacterSet_utf8mb4, true, true, false, false, 0, "NO PAD", encodings.Utf8mb4_0900_ai_ci_RuneWeight},
   651  	/*256*/ {Collation_utf8mb4_de_pb_0900_ai_ci, "utf8mb4_de_pb_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_de_pb_0900_ai_ci_RuneWeight},
   652  	/*257*/ {Collation_utf8mb4_is_0900_ai_ci, "utf8mb4_is_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_is_0900_ai_ci_RuneWeight},
   653  	/*258*/ {Collation_utf8mb4_lv_0900_ai_ci, "utf8mb4_lv_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_lv_0900_ai_ci_RuneWeight},
   654  	/*259*/ {Collation_utf8mb4_ro_0900_ai_ci, "utf8mb4_ro_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_ro_0900_ai_ci_RuneWeight},
   655  	/*260*/ {Collation_utf8mb4_sl_0900_ai_ci, "utf8mb4_sl_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_sl_0900_ai_ci_RuneWeight},
   656  	/*261*/ {Collation_utf8mb4_pl_0900_ai_ci, "utf8mb4_pl_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_pl_0900_ai_ci_RuneWeight},
   657  	/*262*/ {Collation_utf8mb4_et_0900_ai_ci, "utf8mb4_et_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_et_0900_ai_ci_RuneWeight},
   658  	/*263*/ {Collation_utf8mb4_es_0900_ai_ci, "utf8mb4_es_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_es_0900_ai_ci_RuneWeight},
   659  	/*264*/ {Collation_utf8mb4_sv_0900_ai_ci, "utf8mb4_sv_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_sv_0900_ai_ci_RuneWeight},
   660  	/*265*/ {Collation_utf8mb4_tr_0900_ai_ci, "utf8mb4_tr_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_tr_0900_ai_ci_RuneWeight},
   661  	/*266*/ {Collation_utf8mb4_cs_0900_ai_ci, "utf8mb4_cs_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_cs_0900_ai_ci_RuneWeight},
   662  	/*267*/ {Collation_utf8mb4_da_0900_ai_ci, "utf8mb4_da_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_da_0900_ai_ci_RuneWeight},
   663  	/*268*/ {Collation_utf8mb4_lt_0900_ai_ci, "utf8mb4_lt_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_lt_0900_ai_ci_RuneWeight},
   664  	/*269*/ {Collation_utf8mb4_sk_0900_ai_ci, "utf8mb4_sk_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_sk_0900_ai_ci_RuneWeight},
   665  	/*270*/ {Collation_utf8mb4_es_trad_0900_ai_ci, "utf8mb4_es_trad_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_es_trad_0900_ai_ci_RuneWeight},
   666  	/*271*/ {Collation_utf8mb4_la_0900_ai_ci, "utf8mb4_la_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_la_0900_ai_ci_RuneWeight},
   667  	/*272*/ {},
   668  	/*273*/ {Collation_utf8mb4_eo_0900_ai_ci, "utf8mb4_eo_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_eo_0900_ai_ci_RuneWeight},
   669  	/*274*/ {Collation_utf8mb4_hu_0900_ai_ci, "utf8mb4_hu_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_hu_0900_ai_ci_RuneWeight},
   670  	/*275*/ {Collation_utf8mb4_hr_0900_ai_ci, "utf8mb4_hr_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_hr_0900_ai_ci_RuneWeight},
   671  	/*276*/ {},
   672  	/*277*/ {Collation_utf8mb4_vi_0900_ai_ci, "utf8mb4_vi_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, false, 0, "NO PAD", encodings.Utf8mb4_vi_0900_ai_ci_RuneWeight},
   673  	/*278*/ {Collation_utf8mb4_0900_as_cs, "utf8mb4_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_0900_as_cs_RuneWeight},
   674  	/*279*/ {Collation_utf8mb4_de_pb_0900_as_cs, "utf8mb4_de_pb_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_de_pb_0900_as_cs_RuneWeight},
   675  	/*280*/ {Collation_utf8mb4_is_0900_as_cs, "utf8mb4_is_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_is_0900_as_cs_RuneWeight},
   676  	/*281*/ {Collation_utf8mb4_lv_0900_as_cs, "utf8mb4_lv_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_lv_0900_as_cs_RuneWeight},
   677  	/*282*/ {Collation_utf8mb4_ro_0900_as_cs, "utf8mb4_ro_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_ro_0900_as_cs_RuneWeight},
   678  	/*283*/ {Collation_utf8mb4_sl_0900_as_cs, "utf8mb4_sl_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_sl_0900_as_cs_RuneWeight},
   679  	/*284*/ {Collation_utf8mb4_pl_0900_as_cs, "utf8mb4_pl_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_pl_0900_as_cs_RuneWeight},
   680  	/*285*/ {Collation_utf8mb4_et_0900_as_cs, "utf8mb4_et_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_et_0900_as_cs_RuneWeight},
   681  	/*286*/ {Collation_utf8mb4_es_0900_as_cs, "utf8mb4_es_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_es_0900_as_cs_RuneWeight},
   682  	/*287*/ {Collation_utf8mb4_sv_0900_as_cs, "utf8mb4_sv_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_sv_0900_as_cs_RuneWeight},
   683  	/*288*/ {Collation_utf8mb4_tr_0900_as_cs, "utf8mb4_tr_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_tr_0900_as_cs_RuneWeight},
   684  	/*289*/ {Collation_utf8mb4_cs_0900_as_cs, "utf8mb4_cs_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_cs_0900_as_cs_RuneWeight},
   685  	/*290*/ {Collation_utf8mb4_da_0900_as_cs, "utf8mb4_da_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_da_0900_as_cs_RuneWeight},
   686  	/*291*/ {Collation_utf8mb4_lt_0900_as_cs, "utf8mb4_lt_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_lt_0900_as_cs_RuneWeight},
   687  	/*292*/ {Collation_utf8mb4_sk_0900_as_cs, "utf8mb4_sk_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_sk_0900_as_cs_RuneWeight},
   688  	/*293*/ {Collation_utf8mb4_es_trad_0900_as_cs, "utf8mb4_es_trad_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_es_trad_0900_as_cs_RuneWeight},
   689  	/*294*/ {Collation_utf8mb4_la_0900_as_cs, "utf8mb4_la_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_la_0900_as_cs_RuneWeight},
   690  	/*295*/ {},
   691  	/*296*/ {Collation_utf8mb4_eo_0900_as_cs, "utf8mb4_eo_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_eo_0900_as_cs_RuneWeight},
   692  	/*297*/ {Collation_utf8mb4_hu_0900_as_cs, "utf8mb4_hu_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_hu_0900_as_cs_RuneWeight},
   693  	/*298*/ {Collation_utf8mb4_hr_0900_as_cs, "utf8mb4_hr_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_hr_0900_as_cs_RuneWeight},
   694  	/*299*/ {},
   695  	/*300*/ {Collation_utf8mb4_vi_0900_as_cs, "utf8mb4_vi_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_vi_0900_as_cs_RuneWeight},
   696  	/*301*/ {},
   697  	/*302*/ {},
   698  	/*303*/ {Collation_utf8mb4_ja_0900_as_cs, "utf8mb4_ja_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_ja_0900_as_cs_RuneWeight},
   699  	/*304*/ {Collation_utf8mb4_ja_0900_as_cs_ks, "utf8mb4_ja_0900_as_cs_ks", CharacterSet_utf8mb4, false, true, false, true, 24, "NO PAD", encodings.Utf8mb4_ja_0900_as_cs_ks_RuneWeight},
   700  	/*305*/ {Collation_utf8mb4_0900_as_ci, "utf8mb4_0900_as_ci", CharacterSet_utf8mb4, false, true, false, true, 0, "NO PAD", encodings.Utf8mb4_0900_as_ci_RuneWeight},
   701  	/*306*/ {Collation_utf8mb4_ru_0900_ai_ci, "utf8mb4_ru_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, true, 0, "NO PAD", encodings.Utf8mb4_ru_0900_ai_ci_RuneWeight},
   702  	/*307*/ {Collation_utf8mb4_ru_0900_as_cs, "utf8mb4_ru_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_ru_0900_as_cs_RuneWeight},
   703  	/*308*/ {Collation_utf8mb4_zh_0900_as_cs, "utf8mb4_zh_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", encodings.Utf8mb4_zh_0900_as_cs_RuneWeight},
   704  	/*309*/ {Collation_utf8mb4_0900_bin, "utf8mb4_0900_bin", CharacterSet_utf8mb4, false, true, true, true, 1, "NO PAD", encodings.Utf8mb4_0900_bin_RuneWeight},
   705  	/*310*/ {Collation_utf8mb4_nb_0900_ai_ci, "utf8mb4_nb_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, true, 0, "NO PAD", nil},
   706  	/*311*/ {Collation_utf8mb4_nb_0900_as_cs, "utf8mb4_nb_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", nil},
   707  	/*312*/ {Collation_utf8mb4_nn_0900_ai_ci, "utf8mb4_nn_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, true, 0, "NO PAD", nil},
   708  	/*313*/ {Collation_utf8mb4_nn_0900_as_cs, "utf8mb4_nn_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", nil},
   709  	/*314*/ {Collation_utf8mb4_sr_latn_0900_ai_ci, "utf8mb4_sr_latn_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, true, 0, "NO PAD", nil},
   710  	/*315*/ {Collation_utf8mb4_sr_latn_0900_as_cs, "utf8mb4_sr_latn_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", nil},
   711  	/*316*/ {Collation_utf8mb4_bs_0900_ai_ci, "utf8mb4_bs_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, true, 0, "NO PAD", nil},
   712  	/*317*/ {Collation_utf8mb4_bs_0900_as_cs, "utf8mb4_bs_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", nil},
   713  	/*318*/ {Collation_utf8mb4_bg_0900_ai_ci, "utf8mb4_bg_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, true, 0, "NO PAD", nil},
   714  	/*319*/ {Collation_utf8mb4_bg_0900_as_cs, "utf8mb4_bg_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", nil},
   715  	/*320*/ {Collation_utf8mb4_gl_0900_ai_ci, "utf8mb4_gl_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, true, 0, "NO PAD", nil},
   716  	/*321*/ {Collation_utf8mb4_gl_0900_as_cs, "utf8mb4_gl_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", nil},
   717  	/*322*/ {Collation_utf8mb4_mn_cyrl_0900_ai_ci, "utf8mb4_mn_cyrl_0900_ai_ci", CharacterSet_utf8mb4, false, true, false, true, 0, "NO PAD", nil},
   718  	/*323*/ {Collation_utf8mb4_mn_cyrl_0900_as_cs, "utf8mb4_mn_cyrl_0900_as_cs", CharacterSet_utf8mb4, false, true, true, true, 0, "NO PAD", nil},
   719  }
   720  
   721  func init() {
   722  	for _, collation := range collationArray {
   723  		if len(collation.Name) == 0 {
   724  			continue
   725  		}
   726  		collationStringToID[collation.Name] = collation.ID
   727  	}
   728  
   729  	defaultCollation := collationArray[Collation_Default]
   730  	collationArray[0].Name = defaultCollation.Name
   731  	collationArray[0].SortLength = defaultCollation.SortLength
   732  	collationArray[0].PadAttribute = defaultCollation.PadAttribute
   733  	collationArray[0].Sorter = defaultCollation.Sorter
   734  
   735  	collationStringToID["utf8_general_ci"] = Collation_utf8mb3_general_ci
   736  	collationStringToID["utf8_tolower_ci"] = Collation_utf8mb3_tolower_ci
   737  	collationStringToID["utf8_bin"] = Collation_utf8mb3_bin
   738  	collationStringToID["utf8_unicode_ci"] = Collation_utf8mb3_unicode_ci
   739  	collationStringToID["utf8_icelandic_ci"] = Collation_utf8mb3_icelandic_ci
   740  	collationStringToID["utf8_latvian_ci"] = Collation_utf8mb3_latvian_ci
   741  	collationStringToID["utf8_romanian_ci"] = Collation_utf8mb3_romanian_ci
   742  	collationStringToID["utf8_slovenian_ci"] = Collation_utf8mb3_slovenian_ci
   743  	collationStringToID["utf8_polish_ci"] = Collation_utf8mb3_polish_ci
   744  	collationStringToID["utf8_estonian_ci"] = Collation_utf8mb3_estonian_ci
   745  	collationStringToID["utf8_spanish_ci"] = Collation_utf8mb3_spanish_ci
   746  	collationStringToID["utf8_swedish_ci"] = Collation_utf8mb3_swedish_ci
   747  	collationStringToID["utf8_turkish_ci"] = Collation_utf8mb3_turkish_ci
   748  	collationStringToID["utf8_czech_ci"] = Collation_utf8mb3_czech_ci
   749  	collationStringToID["utf8_danish_ci"] = Collation_utf8mb3_danish_ci
   750  	collationStringToID["utf8_lithuanian_ci"] = Collation_utf8mb3_lithuanian_ci
   751  	collationStringToID["utf8_slovak_ci"] = Collation_utf8mb3_slovak_ci
   752  	collationStringToID["utf8_spanish2_ci"] = Collation_utf8mb3_spanish2_ci
   753  	collationStringToID["utf8_roman_ci"] = Collation_utf8mb3_roman_ci
   754  	collationStringToID["utf8_persian_ci"] = Collation_utf8mb3_persian_ci
   755  	collationStringToID["utf8_esperanto_ci"] = Collation_utf8mb3_esperanto_ci
   756  	collationStringToID["utf8_hungarian_ci"] = Collation_utf8mb3_hungarian_ci
   757  	collationStringToID["utf8_sinhala_ci"] = Collation_utf8mb3_sinhala_ci
   758  	collationStringToID["utf8_german2_ci"] = Collation_utf8mb3_german2_ci
   759  	collationStringToID["utf8_croatian_ci"] = Collation_utf8mb3_croatian_ci
   760  	collationStringToID["utf8_unicode_520_ci"] = Collation_utf8mb3_unicode_520_ci
   761  	collationStringToID["utf8_vietnamese_ci"] = Collation_utf8mb3_vietnamese_ci
   762  	collationStringToID["utf8_general_mysql500_ci"] = Collation_utf8mb3_general_mysql500_ci
   763  }
   764  
   765  // ParseCollation takes in an optional character set and collation, along with the binary attribute if present,
   766  // and returns a valid collation or error. A nil character set and collation will return the default collation.
   767  func ParseCollation(characterSetStr *string, collationStr *string, binaryAttribute bool) (CollationID, error) {
   768  	if characterSetStr == nil || len(*characterSetStr) == 0 {
   769  		if collationStr == nil || len(*collationStr) == 0 {
   770  			return Collation_Unspecified, nil
   771  		}
   772  		if collation, ok := collationStringToID[strings.ToLower(*collationStr)]; ok {
   773  			if binaryAttribute {
   774  				return collation.CharacterSet().BinaryCollation(), nil
   775  			}
   776  			return collation, nil
   777  		}
   778  		return Collation_Unspecified, ErrCollationUnknown.New(*collationStr)
   779  	} else {
   780  		characterSet, err := ParseCharacterSet(*characterSetStr)
   781  		if err != nil {
   782  			return Collation_Unspecified, err
   783  		}
   784  		if collationStr == nil || len(*collationStr) == 0 {
   785  			if binaryAttribute {
   786  				return characterSet.BinaryCollation(), nil
   787  			}
   788  			return characterSet.DefaultCollation(), nil
   789  		}
   790  		collation, exists := collationStringToID[strings.ToLower(*collationStr)]
   791  		if !exists {
   792  			return Collation_Unspecified, ErrCollationUnknown.New(*collationStr)
   793  		}
   794  		if !collation.WorksWithCharacterSet(characterSet) {
   795  			return Collation_Unspecified, fmt.Errorf("%v is not a valid character set for %v", characterSet, collation)
   796  		}
   797  		return collation, nil
   798  	}
   799  }
   800  
   801  // Name returns the name of this collation.
   802  func (c CollationID) Name() string {
   803  	return collationArray[c].Name
   804  }
   805  
   806  // CharacterSet returns the CharacterSetID belonging to this Collation.
   807  func (c CollationID) CharacterSet() CharacterSetID {
   808  	return collationArray[c].CharacterSet
   809  }
   810  
   811  // WorksWithCharacterSet returns whether the Collation is valid for the given CharacterSet.
   812  func (c CollationID) WorksWithCharacterSet(cs CharacterSetID) bool {
   813  	return collationArray[c].CharacterSet == cs
   814  }
   815  
   816  // String returns the string representation of the Collation.
   817  func (c CollationID) String() string {
   818  	return collationArray[c].Name
   819  }
   820  
   821  // IsDefault returns a string indicating whether this collation is the default for the character set.
   822  func (c CollationID) IsDefault() string {
   823  	if collationArray[c].IsDefault {
   824  		return "Yes"
   825  	}
   826  	return ""
   827  }
   828  
   829  // IsCompiled returns a string indicating whether this collation is compiled.
   830  func (c CollationID) IsCompiled() string {
   831  	if collationArray[c].IsCompiled {
   832  		return "Yes"
   833  	}
   834  	return ""
   835  }
   836  
   837  // SortLength returns the sort length of the collation.
   838  func (c CollationID) SortLength() uint32 {
   839  	return uint32(collationArray[c].SortLength)
   840  }
   841  
   842  // PadAttribute returns a string representing the pad attribute of the collation.
   843  func (c CollationID) PadAttribute() string {
   844  	return collationArray[c].PadAttribute
   845  }
   846  
   847  // Equals returns whether the given collation is the same as the calling collation.
   848  func (c CollationID) Equals(other CollationID) bool {
   849  	return c == other
   850  }
   851  
   852  // Collation returns the Collation with this ID.
   853  func (c CollationID) Collation() Collation {
   854  	return collationArray[c]
   855  }
   856  
   857  var weightBuffers = sync.Pool{
   858  	New: func() interface{} {
   859  		return new([]byte)
   860  	},
   861  }
   862  
   863  // WriteWeightString writes the weights of each codepoint in the string into the given io.Writer.
   864  // Two strings with technically different contents may generate the same WeightString to the same value, as the collation
   865  // considers them the same string.
   866  func (c CollationID) WriteWeightString(hash io.Writer, str string) error {
   867  	if c == Collation_binary {
   868  		// Binary strings are almost always malformed due to their usage, therefore we treat them differently
   869  		_, err := hash.Write(encodings.StringToBytes(str))
   870  		if err != nil {
   871  			return err
   872  		}
   873  	} else {
   874  		getRuneWeight := collationArray[c].Sorter
   875  		i := 0
   876  		buf := *weightBuffers.Get().(*[]byte)
   877  		if cap(buf) < len(str)*4 {
   878  			buf = make([]byte, len(str)*4)
   879  		}
   880  		for len(str) > 0 {
   881  			// All strings (should) have been decoded at this point, so we can rely on Go's internal string encoding
   882  			runeFromString, strRead := utf8.DecodeRuneInString(str)
   883  			if strRead == 0 || strRead == utf8.RuneError {
   884  				return ErrCollationMalformedString.New("hashing")
   885  			}
   886  			runeWeight := getRuneWeight(runeFromString)
   887  			buf[i*4] = byte(runeWeight)
   888  			buf[i*4+1] = byte(runeWeight >> 8)
   889  			buf[i*4+2] = byte(runeWeight >> 16)
   890  			buf[i*4+3] = byte(runeWeight >> 24)
   891  			_, err := hash.Write(buf[i*4 : i*4+4])
   892  			if err != nil {
   893  				return err
   894  			}
   895  			str = str[strRead:]
   896  			i++
   897  		}
   898  		weightBuffers.Put(&buf)
   899  	}
   900  	return nil
   901  }
   902  
   903  // HashToUint returns a hash of the given decoded string based on the collation. Collations take each rune's weight into
   904  // account, therefore two strings with technically different contents may hash to the same value, as the collation
   905  // considers them the same string.
   906  func (c CollationID) HashToUint(str string) (uint64, error) {
   907  	hash := xxhash.New()
   908  	err := c.WriteWeightString(hash, str)
   909  	if err != nil {
   910  		return 0, err
   911  	}
   912  	return hash.Sum64(), nil
   913  }
   914  
   915  // HashToBytes returns a hash of the given decoded string based on the collation. Collations take each rune's weight
   916  // into account, therefore two strings with technically different contents may hash to the same value, as the collation
   917  // considers them the same string. This is equivalent to HashToUint, except that it converts the uint64 to a byte slice.
   918  func (c CollationID) HashToBytes(str string) ([]byte, error) {
   919  	hash, err := c.HashToUint(str)
   920  	if err != nil {
   921  		return nil, err
   922  	}
   923  	return []byte{
   924  		byte(hash),
   925  		byte(hash >> 8),
   926  		byte(hash >> 16),
   927  		byte(hash >> 24),
   928  		byte(hash >> 32),
   929  		byte(hash >> 40),
   930  		byte(hash >> 48),
   931  		byte(hash >> 56),
   932  	}, nil
   933  }
   934  
   935  // Sorter returns this collation's sort function. As collations are a work-in-progress, it is recommended to avoid
   936  // using any collations that return a nil sort function.
   937  func (c CollationID) Sorter() CollationSorter {
   938  	return collationArray[c].Sorter
   939  }
   940  
   941  // NewCollationsIterator returns a new CollationsIterator.
   942  func NewCollationsIterator() *CollationsIterator {
   943  	return &CollationsIterator{0}
   944  }
   945  
   946  // Next returns the next collation. If all collations have been iterated over, returns false.
   947  func (ci *CollationsIterator) Next() (Collation, bool) {
   948  	for ; ci.idx < len(collationArray); ci.idx++ {
   949  		if collationArray[ci.idx].ID == 0 {
   950  			continue
   951  		}
   952  		ci.idx++
   953  		return collationArray[ci.idx-1], true
   954  	}
   955  	return Collation{}, false
   956  }
   957  
   958  // TypeWithCollation is implemented on all types that may return a collation.
   959  type TypeWithCollation interface {
   960  	// Collation returns the collation belonging to this type.
   961  	Collation() CollationID
   962  	// WithNewCollation returns a replica of this type, except with the given collation replacing the existing collation.
   963  	WithNewCollation(collation CollationID) (Type, error)
   964  	// StringWithTableCollation converts this type to a string, however it uses the given table collation to determine
   965  	// whether to include the character set and/or collation information.
   966  	StringWithTableCollation(tableCollation CollationID) string
   967  }