Repository: vitessio/vitess
Pull request #10139 (2022-04-25 19:54:38)

Add support for non aggregated columns in `OrderedAggregate`
## Description

We do not keep track of the [ONLY_FULL_GROUP_BY](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_only_full_group_by) setting in VTGate, thus we were failing certain query like the one below even though they should be executed if the setting is set to false.

```
select city, age from user group by city
# age is a non aggregated column here, the query should fail if sql_mode=only_full_group_by
```

This PR adds support for non aggregated columns in the `OrderedAggregate`. We should be able to plan a query that has non aggregated columns and send it to MySQL. Bases on the MySQL mode, MySQL can decide to fail this query or not.

## Related Issue(s)

- fixes https://github.com/vitessio/vitess/issues/9889

## Checklist

-   [ ] "Backport me!" label has been added if this change should be backported
-   [x] Tests were added or are not required
-   [x] Documentation was added or is not required


frouioui: This Pull Request depends on https://github.com/vitessio/vitess/pull/10163 for a fix in how we handle reserved connections for field queries. Do not merge until https://github.com/vitessio/vitess/pull/10163 is merged.
derekperkins: To clarify on the description, this will also allow for similar queries to succeed even if [ONLY_FULL_GROUP_BY](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_only_full_group_by) is enabled, when MySQL can determine that those columns are functionally dependent on a grouping column
systay: we should probably write something about this in our docs, so that people know that Vitess allows it and that the functionality depends on mysql to also allow it

Patch:
diff --git a/go/mysql/collations/coercion.go b/go/mysql/collations/coercion.go
index 227389a52b..17fab8ac43 100644
--- a/go/mysql/collations/coercion.go
+++ b/go/mysql/collations/coercion.go
@@ -138,7 +138,7 @@ func checkCompatibleCollations(
 			}
 		}
 
-	case charset.Charset_utf8, charset.Charset_ucs2, charset.Charset_utf16, charset.Charset_utf16le:
+	case charset.Charset_utf8mb3, charset.Charset_ucs2, charset.Charset_utf16, charset.Charset_utf16le:
 		switch {
 		case leftCoercibility < rightCoercibility:
 			return true
diff --git a/go/mysql/collations/env.go b/go/mysql/collations/env.go
index 7bbf58ce7b..2dbf7e5e4c 100644
--- a/go/mysql/collations/env.go
+++ b/go/mysql/collations/env.go
@@ -162,24 +162,27 @@ func makeEnv(version collver) *Environment {
 	}
 
 	for collid, vi := range globalVersionInfo {
-		var ourname string
-		for mask, name := range vi.alias {
-			if mask&version != 0 {
-				ourname = name
-				break
+		var ournames []string
+		for _, alias := range vi.alias {
+			if alias.mask&version != 0 {
+				ournames = append(ournames, alias.name)
 			}
 		}
-		if ourname == "" {
+		if len(ournames) == 0 {
 			continue
 		}
 
 		collation, ok := globalAllCollations[collid]
 		if !ok {
-			env.unsupported[ourname] = collid
+			for _, name := range ournames {
+				env.unsupported[name] = collid
+			}
 			continue
 		}
 
-		env.byName[ourname] = collation
+		for _, name := range ournames {
+			env.byName[name] = collation
+		}
 		env.byID[collid] = collation
 
 		csname := collation.Charset().Name()
@@ -200,6 +203,11 @@ func makeEnv(version collver) *Environment {
 			defaults.Binary = collation
 		}
 	}
+
+	for from, to := range version.charsetAliases() {
+		env.byCharset[from] = env.byCharset[to]
+	}
+
 	return env
 }
 
@@ -211,6 +219,15 @@ const (
 	CollationBinaryID  = 63
 )
 
+// CharsetAlias returns the internal charset name for the given charset.
+// For now, this only maps `utf8` to `utf8mb3`; in future versions of MySQL,
+// this mapping will change, so it's important to use this helper so that
+// Vitess code has a consistent mapping for the active collations environment.
+func (env *Environment) CharsetAlias(charset string) (alias string, ok bool) {
+	alias, ok = env.version.charsetAliases()[charset]
+	return
+}
+
 // DefaultConnectionCharset is the default charset that Vitess will use when negotiating a
 // charset in a MySQL connection handshake. Note that in this context, a 'charset' is equivalent
 // to a Collation ID, with the exception that it can only fit in 1 byte.
diff --git a/go/mysql/collations/internal/charset/charset.go b/go/mysql/collations/internal/charset/charset.go
index 8385ba7f0b..41b43cdbbe 100644
--- a/go/mysql/collations/internal/charset/charset.go
+++ b/go/mysql/collations/internal/charset/charset.go
@@ -40,7 +40,7 @@ type UnicodeMapping = eightbit.UnicodeMapping
 
 // Unicode encodings
 
-type Charset_utf8 = unicode.Charset_utf8mb3
+type Charset_utf8mb3 = unicode.Charset_utf8mb3
 type Charset_utf8mb4 = unicode.Charset_utf8mb4
 type Charset_utf16 = unicode.Charset_utf16be
 type Charset_utf16le = unicode.Charset_utf16le
@@ -75,7 +75,7 @@ func IsMultibyteByName(csname string) bool {
 
 func IsUnicode(charset Charset) bool {
 	switch charset.(type) {
-	case Charset_utf8, Charset_utf8mb4:
+	case Charset_utf8mb3, Charset_utf8mb4:
 		return true
 	case Charset_utf16, Charset_utf16le, Charset_ucs2:
 		return true
@@ -88,7 +88,7 @@ func IsUnicode(charset Charset) bool {
 
 func IsUnicodeByName(csname string) bool {
 	switch csname {
-	case "utf8", "utf8mb4", "utf16", "utf16le", "ucs2", "utf32":
+	case "utf8", "utf8mb3", "utf8mb4", "utf16", "utf16le", "ucs2", "utf32":
 		return true
 	default:
 		return false
diff --git a/go/mysql/collations/internal/charset/convert.go b/go/mysql/collations/internal/charset/convert.go
index 66dd093f09..43189ade91 100644
--- a/go/mysql/collations/internal/charset/convert.go
+++ b/go/mysql/collations/internal/charset/convert.go
@@ -115,7 +115,7 @@ func Convert(dst []byte, dstCharset Charset, src []byte, srcCharset Charset) ([]
 		return trans.Convert(dst, src, srcCharset)
 	}
 	switch srcCharset.(type) {
-	case Charset_utf8, Charset_utf8mb4:
+	case Charset_utf8mb3, Charset_utf8mb4:
 		return convertFastFromUTF8(dst, dstCharset, src)
 	default:
 		return convertSlow(dst, dstCharset, src, srcCharset)
diff --git a/go/mysql/collations/internal/charset/unicode/utf8.go b/go/mysql/collations/internal/charset/unicode/utf8.go
index fa92a71e1f..e33df1fcbe 100644
--- a/go/mysql/collations/internal/charset/unicode/utf8.go
+++ b/go/mysql/collations/internal/charset/unicode/utf8.go
@@ -101,7 +101,7 @@ var acceptRanges = [16]acceptRange{
 type Charset_utf8mb3 struct{}
 
 func (u Charset_utf8mb3) Name() string {
-	return "utf8"
+	return "utf8mb3"
 }
 
 func (u Charset_utf8mb3) IsSuperset(other types.Charset) bool {
diff --git a/go/mysql/collations/mysqldata.go b/go/mysql/collations/mysqldata.go
index 4394954c8f..636e4ef60b 100644
--- a/go/mysql/collations/mysqldata.go
+++ b/go/mysql/collations/mysqldata.go
@@ -2782,7 +2782,7 @@ func init() {
 		id:      0x21,
 		name:    "utf8_general_ci",
 		unicase: unicaseInfo_default,
-		charset: charset.Charset_utf8{},
+		charset: charset.Charset_utf8mb3{},
 	})
 	register(&Collation_unicode_general_ci{
 		id:      0x23,
@@ -3223,7 +3223,7 @@ func init() {
 	register(&Collation_unicode_bin{
 		id:      0x53,
 		name:    "utf8_bin",
-		charset: charset.Charset_utf8{},
+		charset: charset.Charset_utf8mb3{},
 	})
 	register(&Collation_multibyte{
 		id:      0x55,
@@ -3905,14 +3905,14 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_unicode_ci",
 		id:           0xc0,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		maxCodepoint: 0xFFFF,
 	})
 	register(&Collation_uca_legacy{
 		name:         "utf8_icelandic_ci",
 		id:           0xc1,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_icelandic_ci,
 		maxCodepoint: 0xFFFF,
@@ -3920,7 +3920,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_latvian_ci",
 		id:           0xc2,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_latvian_ci,
 		maxCodepoint: 0xFFFF,
@@ -3928,7 +3928,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_romanian_ci",
 		id:           0xc3,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_romanian_ci,
 		maxCodepoint: 0xFFFF,
@@ -3936,7 +3936,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_slovenian_ci",
 		id:           0xc4,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_slovenian_ci,
 		maxCodepoint: 0xFFFF,
@@ -3944,7 +3944,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_polish_ci",
 		id:           0xc5,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_polish_ci,
 		maxCodepoint: 0xFFFF,
@@ -3952,7 +3952,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_estonian_ci",
 		id:           0xc6,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_estonian_ci,
 		maxCodepoint: 0xFFFF,
@@ -3960,7 +3960,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_spanish_ci",
 		id:           0xc7,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_spanish_ci,
 		maxCodepoint: 0xFFFF,
@@ -3968,7 +3968,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_swedish_ci",
 		id:           0xc8,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_swedish_ci,
 		maxCodepoint: 0xFFFF,
@@ -3976,7 +3976,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_turkish_ci",
 		id:           0xc9,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_turkish_ci,
 		maxCodepoint: 0xFFFF,
@@ -3984,7 +3984,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_czech_ci",
 		id:           0xca,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_czech_ci,
 		contract:     contractor_utf16_czech_ci{},
@@ -3993,7 +3993,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_danish_ci",
 		id:           0xcb,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_danish_ci,
 		contract:     contractor_utf16_danish_ci{},
@@ -4002,7 +4002,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_lithuanian_ci",
 		id:           0xcc,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_lithuanian_ci,
 		contract:     contractor_utf16_lithuanian_ci{},
@@ -4011,7 +4011,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_slovak_ci",
 		id:           0xcd,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_slovak_ci,
 		contract:     contractor_utf16_czech_ci{},
@@ -4020,7 +4020,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_spanish2_ci",
 		id:           0xce,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_spanish_ci,
 		contract:     contractor_utf16_spanish2_ci{},
@@ -4029,7 +4029,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_roman_ci",
 		id:           0xcf,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_roman_ci,
 		maxCodepoint: 0xFFFF,
@@ -4037,7 +4037,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_persian_ci",
 		id:           0xd0,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_persian_ci,
 		maxCodepoint: 0xFFFF,
@@ -4045,7 +4045,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_esperanto_ci",
 		id:           0xd1,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_esperanto_ci,
 		maxCodepoint: 0xFFFF,
@@ -4053,7 +4053,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_hungarian_ci",
 		id:           0xd2,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_hungarian_ci,
 		maxCodepoint: 0xFFFF,
@@ -4061,7 +4061,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_sinhala_ci",
 		id:           0xd3,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_sinhala_ci,
 		maxCodepoint: 0xFFFF,
@@ -4069,7 +4069,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_german2_ci",
 		id:           0xd4,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_german2_ci,
 		maxCodepoint: 0xFFFF,
@@ -4077,7 +4077,7 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_croatian_ci",
 		id:           0xd5,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_croatian_ci,
 		contract:     contractor_utf16_croatian_ci{},
@@ -4086,14 +4086,14 @@ func init() {
 	register(&Collation_uca_legacy{
 		name:         "utf8_unicode_520_ci",
 		id:           0xd6,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca520,
 		maxCodepoint: 0x10FFFF,
 	})
 	register(&Collation_uca_legacy{
 		name:         "utf8_vietnamese_ci",
 		id:           0xd7,
-		charset:      charset.Charset_utf8{},
+		charset:      charset.Charset_utf8mb3{},
 		weights:      weightTable_uca400,
 		tailoring:    weightTailoring_utf16_vietnamese_ci,
 		maxCodepoint: 0xFFFF,
diff --git a/go/mysql/collations/mysqlversion.go b/go/mysql/collations/mysqlversion.go
index 6c955551fb..e76ac9110f 100644
--- a/go/mysql/collations/mysqlversion.go
+++ b/go/mysql/collations/mysqlversion.go
@@ -3,6 +3,10 @@
 package collations
 
 type collver byte
+type collalias struct {
+	mask collver
+	name string
+}
 
 const (
 	collverInvalid    collver = 0
@@ -37,384 +41,385 @@ func (v collver) String() string {
 		panic("invalid version identifier")
 	}
 }
+func (v collver) charsetAliases() map[string]string { return map[string]string{"utf8": "utf8mb3"} }
 
 var globalVersionInfo = map[ID]struct {
-	alias     map[collver]string
+	alias     []collalias
 	isdefault collver
 }{
-	1:    {alias: map[collver]string{0b01111111: "big5_chinese_ci"}, isdefault: 0b01111111},
-	2:    {alias: map[collver]string{0b01111111: "latin2_czech_cs"}, isdefault: 0b00000000},
-	3:    {alias: map[collver]string{0b01111111: "dec8_swedish_ci"}, isdefault: 0b01111111},
-	4:    {alias: map[collver]string{0b01111111: "cp850_general_ci"}, isdefault: 0b01111111},
-	5:    {alias: map[collver]string{0b01111111: "latin1_german1_ci"}, isdefault: 0b00000000},
-	6:    {alias: map[collver]string{0b01111111: "hp8_english_ci"}, isdefault: 0b01111111},
-	7:    {alias: map[collver]string{0b01111111: "koi8r_general_ci"}, isdefault: 0b01111111},
-	8:    {alias: map[collver]string{0b01111111: "latin1_swedish_ci"}, isdefault: 0b01111111},
-	9:    {alias: map[collver]string{0b01111111: "latin2_general_ci"}, isdefault: 0b01111111},
-	10:   {alias: map[collver]string{0b01111111: "swe7_swedish_ci"}, isdefault: 0b01111111},
-	11:   {alias: map[collver]string{0b01111111: "ascii_general_ci"}, isdefault: 0b01111111},
-	12:   {alias: map[collver]string{0b01111111: "ujis_japanese_ci"}, isdefault: 0b01111111},
-	13:   {alias: map[collver]string{0b01111111: "sjis_japanese_ci"}, isdefault: 0b01111111},
-	14:   {alias: map[collver]string{0b01111111: "cp1251_bulgarian_ci"}, isdefault: 0b00000000},
-	15:   {alias: map[collver]string{0b01111111: "latin1_danish_ci"}, isdefault: 0b00000000},
-	16:   {alias: map[collver]string{0b01111111: "hebrew_general_ci"}, isdefault: 0b01111111},
-	18:   {alias: map[collver]string{0b01111111: "tis620_thai_ci"}, isdefault: 0b01111111},
-	19:   {alias: map[collver]string{0b01111111: "euckr_korean_ci"}, isdefault: 0b01111111},
-	20:   {alias: map[collver]string{0b01111111: "latin7_estonian_cs"}, isdefault: 0b00000000},
-	21:   {alias: map[collver]string{0b01111111: "latin2_hungarian_ci"}, isdefault: 0b00000000},
-	22:   {alias: map[collver]string{0b01111111: "koi8u_general_ci"}, isdefault: 0b01111111},
-	23:   {alias: map[collver]string{0b01111111: "cp1251_ukrainian_ci"}, isdefault: 0b00000000},
-	24:   {alias: map[collver]string{0b01111111: "gb2312_chinese_ci"}, isdefault: 0b01111111},
-	25:   {alias: map[collver]string{0b01111111: "greek_general_ci"}, isdefault: 0b01111111},
-	26:   {alias: map[collver]string{0b01111111: "cp1250_general_ci"}, isdefault: 0b01111111},
-	27:   {alias: map[collver]string{0b01111111: "latin2_croatian_ci"}, isdefault: 0b00000000},
-	28:   {alias: map[collver]string{0b01111111: "gbk_chinese_ci"}, isdefault: 0b01111111},
-	29:   {alias: map[collver]string{0b01111111: "cp1257_lithuanian_ci"}, isdefault: 0b00000000},
-	30:   {alias: map[collver]string{0b01111111: "latin5_turkish_ci"}, isdefault: 0b01111111},
-	31:   {alias: map[collver]string{0b01111111: "latin1_german2_ci"}, isdefault: 0b00000000},
-	32:   {alias: map[collver]string{0b01111111: "armscii8_general_ci"}, isdefault: 0b01111111},
-	33:   {alias: map[collver]string{0b01111111: "utf8_general_ci"}, isdefault: 0b01111111},
-	34:   {alias: map[collver]string{0b01111111: "cp1250_czech_cs"}, isdefault: 0b00000000},
-	35:   {alias: map[collver]string{0b01111111: "ucs2_general_ci"}, isdefault: 0b01111111},
-	36:   {alias: map[collver]string{0b01111111: "cp866_general_ci"}, isdefault: 0b01111111},
-	37:   {alias: map[collver]string{0b01111111: "keybcs2_general_ci"}, isdefault: 0b01111111},
-	38:   {alias: map[collver]string{0b01111111: "macce_general_ci"}, isdefault: 0b01111111},
-	39:   {alias: map[collver]string{0b01111111: "macroman_general_ci"}, isdefault: 0b01111111},
-	40:   {alias: map[collver]string{0b01111111: "cp852_general_ci"}, isdefault: 0b01111111},
-	41:   {alias: map[collver]string{0b01111111: "latin7_general_ci"}, isdefault: 0b01111111},
-	42:   {alias: map[collver]string{0b01111111: "latin7_general_cs"}, isdefault: 0b00000000},
-	43:   {alias: map[collver]string{0b01111111: "macce_bin"}, isdefault: 0b00000000},
-	44:   {alias: map[collver]string{0b01111111: "cp1250_croatian_ci"}, isdefault: 0b00000000},
-	45:   {alias: map[collver]string{0b01111111: "utf8mb4_general_ci"}, isdefault: 0b00111111},
-	46:   {alias: map[collver]string{0b01111111: "utf8mb4_bin"}, isdefault: 0b00000000},
-	47:   {alias: map[collver]string{0b01111111: "latin1_bin"}, isdefault: 0b00000000},
-	48:   {alias: map[collver]string{0b01111111: "latin1_general_ci"}, isdefault: 0b00000000},
-	49:   {alias: map[collver]string{0b01111111: "latin1_general_cs"}, isdefault: 0b00000000},
-	50:   {alias: map[collver]string{0b01111111: "cp1251_bin"}, isdefault: 0b00000000},
-	51:   {alias: map[collver]string{0b01111111: "cp1251_general_ci"}, isdefault: 0b01111111},
-	52:   {alias: map[collver]string{0b01111111: "cp1251_general_cs"}, isdefault: 0b00000000},
-	53:   {alias: map[collver]string{0b01111111: "macroman_bin"}, isdefault: 0b00000000},
-	54:   {alias: map[collver]string{0b01111111: "utf16_general_ci"}, isdefault: 0b01111111},
-	55:   {alias: map[collver]string{0b01111111: "utf16_bin"}, isdefault: 0b00000000},
-	56:   {alias: map[collver]string{0b01111111: "utf16le_general_ci"}, isdefault: 0b01111111},
-	57:   {alias: map[collver]string{0b01111111: "cp1256_general_ci"}, isdefault: 0b01111111},
-	58:   {alias: map[collver]string{0b01111111: "cp1257_bin"}, isdefault: 0b00000000},
-	59:   {alias: map[collver]string{0b01111111: "cp1257_general_ci"}, isdefault: 0b01111111},
-	60:   {alias: map[collver]string{0b01111111: "utf32_general_ci"}, isdefault: 0b01111111},
-	61:   {alias: map[collver]string{0b01111111: "utf32_bin"}, isdefault: 0b00000000},
-	62:   {alias: map[collver]string{0b01111111: "utf16le_bin"}, isdefault: 0b00000000},
-	63:   {alias: map[collver]string{0b01111111: "binary"}, isdefault: 0b01111111},
-	64:   {alias: map[collver]string{0b01111111: "armscii8_bin"}, isdefault: 0b00000000},
-	65:   {alias: map[collver]string{0b01111111: "ascii_bin"}, isdefault: 0b00000000},
-	66:   {alias: map[collver]string{0b01111111: "cp1250_bin"}, isdefault: 0b00000000},
-	67:   {alias: map[collver]string{0b01111111: "cp1256_bin"}, isdefault: 0b00000000},
-	68:   {alias: map[collver]string{0b01111111: "cp866_bin"}, isdefault: 0b00000000},
-	69:   {alias: map[collver]string{0b01111111: "dec8_bin"}, isdefault: 0b00000000},
-	70:   {alias: map[collver]string{0b01111111: "greek_bin"}, isdefault: 0b00000000},
-	71:   {alias: map[collver]string{0b01111111: "hebrew_bin"}, isdefault: 0b00000000},
-	72:   {alias: map[collver]string{0b01111111: "hp8_bin"}, isdefault: 0b00000000},
-	73:   {alias: map[collver]string{0b01111111: "keybcs2_bin"}, isdefault: 0b00000000},
-	74:   {alias: map[collver]string{0b01111111: "koi8r_bin"}, isdefault: 0b00000000},
-	75:   {alias: map[collver]string{0b01111111: "koi8u_bin"}, isdefault: 0b00000000},
-	76:   {alias: map[collver]string{0b01000000: "utf8_tolower_ci"}, isdefault: 0b00000000},
-	77:   {alias: map[collver]string{0b01111111: "latin2_bin"}, isdefault: 0b00000000},
-	78:   {alias: map[collver]string{0b01111111: "latin5_bin"}, isdefault: 0b00000000},
-	79:   {alias: map[collver]string{0b01111111: "latin7_bin"}, isdefault: 0b00000000},
-	80:   {alias: map[collver]string{0b01111111: "cp850_bin"}, isdefault: 0b00000000},
-	81:   {alias: map[collver]string{0b01111111: "cp852_bin"}, isdefault: 0b00000000},
-	82:   {alias: map[collver]string{0b01111111: "swe7_bin"}, isdefault: 0b00000000},
-	83:   {alias: map[collver]string{0b01111111: "utf8_bin"}, isdefault: 0b00000000},
-	84:   {alias: map[collver]string{0b01111111: "big5_bin"}, isdefault: 0b00000000},
-	85:   {alias: map[collver]string{0b01111111: "euckr_bin"}, isdefault: 0b00000000},
-	86:   {alias: map[collver]string{0b01111111: "gb2312_bin"}, isdefault: 0b00000000},
-	87:   {alias: map[collver]string{0b01111111: "gbk_bin"}, isdefault: 0b00000000},
-	88:   {alias: map[collver]string{0b01111111: "sjis_bin"}, isdefault: 0b00000000},
-	89:   {alias: map[collver]string{0b01111111: "tis620_bin"}, isdefault: 0b00000000},
-	90:   {alias: map[collver]string{0b01111111: "ucs2_bin"}, isdefault: 0b00000000},
-	91:   {alias: map[collver]string{0b01111111: "ujis_bin"}, isdefault: 0b00000000},
-	92:   {alias: map[collver]string{0b01111111: "geostd8_general_ci"}, isdefault: 0b01111111},
-	93:   {alias: map[collver]string{0b01111111: "geostd8_bin"}, isdefault: 0b00000000},
-	94:   {alias: map[collver]string{0b01111111: "latin1_spanish_ci"}, isdefault: 0b00000000},
-	95:   {alias: map[collver]string{0b01111111: "cp932_japanese_ci"}, isdefault: 0b01111111},
-	96:   {alias: map[collver]string{0b01111111: "cp932_bin"}, isdefault: 0b00000000},
-	97:   {alias: map[collver]string{0b01111111: "eucjpms_japanese_ci"}, isdefault: 0b01111111},
-	98:   {alias: map[collver]string{0b01111111: "eucjpms_bin"}, isdefault: 0b00000000},
-	99:   {alias: map[collver]string{0b01111111: "cp1250_polish_ci"}, isdefault: 0b00000000},
-	101:  {alias: map[collver]string{0b01111111: "utf16_unicode_ci"}, isdefault: 0b00000000},
-	102:  {alias: map[collver]string{0b01111111: "utf16_icelandic_ci"}, isdefault: 0b00000000},
-	103:  {alias: map[collver]string{0b01111111: "utf16_latvian_ci"}, isdefault: 0b00000000},
-	104:  {alias: map[collver]string{0b01111111: "utf16_romanian_ci"}, isdefault: 0b00000000},
-	105:  {alias: map[collver]string{0b01111111: "utf16_slovenian_ci"}, isdefault: 0b00000000},
-	106:  {alias: map[collver]string{0b01111111: "utf16_polish_ci"}, isdefault: 0b00000000},
-	107:  {alias: map[collver]string{0b01111111: "utf16_estonian_ci"}, isdefault: 0b00000000},
-	108:  {alias: map[collver]string{0b01111111: "utf16_spanish_ci"}, isdefault: 0b00000000},
-	109:  {alias: map[collver]string{0b01111111: "utf16_swedish_ci"}, isdefault: 0b00000000},
-	110:  {alias: map[collver]string{0b01111111: "utf16_turkish_ci"}, isdefault: 0b00000000},
-	111:  {alias: map[collver]string{0b01111111: "utf16_czech_ci"}, isdefault: 0b00000000},
-	112:  {alias: map[collver]string{0b01111111: "utf16_danish_ci"}, isdefault: 0b00000000},
-	113:  {alias: map[collver]string{0b01111111: "utf16_lithuanian_ci"}, isdefault: 0b00000000},
-	114:  {alias: map[collver]string{0b01111111: "utf16_slovak_ci"}, isdefault: 0b00000000},
-	115:  {alias: map[collver]string{0b01111111: "utf16_spanish2_ci"}, isdefault: 0b00000000},
-	116:  {alias: map[collver]string{0b01111111: "utf16_roman_ci"}, isdefault: 0b00000000},
-	117:  {alias: map[collver]string{0b01111111: "utf16_persian_ci"}, isdefault: 0b00000000},
-	118:  {alias: map[collver]string{0b01111111: "utf16_esperanto_ci"}, isdefault: 0b00000000},
-	119:  {alias: map[collver]string{0b01111111: "utf16_hungarian_ci"}, isdefault: 0b00000000},
-	120:  {alias: map[collver]string{0b01111111: "utf16_sinhala_ci"}, isdefault: 0b00000000},
-	121:  {alias: map[collver]string{0b01111111: "utf16_german2_ci"}, isdefault: 0b00000000},
-	122:  {alias: map[collver]string{0b01110000: "utf16_croatian_ci", 0b00001111: "utf16_croatian_mysql561_ci"}, isdefault: 0b00000000},
-	123:  {alias: map[collver]string{0b01111111: "utf16_unicode_520_ci"}, isdefault: 0b00000000},
-	124:  {alias: map[collver]string{0b01111111: "utf16_vietnamese_ci"}, isdefault: 0b00000000},
-	128:  {alias: map[collver]string{0b01111111: "ucs2_unicode_ci"}, isdefault: 0b00000000},
-	129:  {alias: map[collver]string{0b01111111: "ucs2_icelandic_ci"}, isdefault: 0b00000000},
-	130:  {alias: map[collver]string{0b01111111: "ucs2_latvian_ci"}, isdefault: 0b00000000},
-	131:  {alias: map[collver]string{0b01111111: "ucs2_romanian_ci"}, isdefault: 0b00000000},
-	132:  {alias: map[collver]string{0b01111111: "ucs2_slovenian_ci"}, isdefault: 0b00000000},
-	133:  {alias: map[collver]string{0b01111111: "ucs2_polish_ci"}, isdefault: 0b00000000},
-	134:  {alias: map[collver]string{0b01111111: "ucs2_estonian_ci"}, isdefault: 0b00000000},
-	135:  {alias: map[collver]string{0b01111111: "ucs2_spanish_ci"}, isdefault: 0b00000000},
-	136:  {alias: map[collver]string{0b01111111: "ucs2_swedish_ci"}, isdefault: 0b00000000},
-	137:  {alias: map[collver]string{0b01111111: "ucs2_turkish_ci"}, isdefault: 0b00000000},
-	138:  {alias: map[collver]string{0b01111111: "ucs2_czech_ci"}, isdefault: 0b00000000},
-	139:  {alias: map[collver]string{0b01111111: "ucs2_danish_ci"}, isdefault: 0b00000000},
-	140:  {alias: map[collver]string{0b01111111: "ucs2_lithuanian_ci"}, isdefault: 0b00000000},
-	141:  {alias: map[collver]string{0b01111111: "ucs2_slovak_ci"}, isdefault: 0b00000000},
-	142:  {alias: map[collver]string{0b01111111: "ucs2_spanish2_ci"}, isdefault: 0b00000000},
-	143:  {alias: map[collver]string{0b01111111: "ucs2_roman_ci"}, isdefault: 0b00000000},
-	144:  {alias: map[collver]string{0b01111111: "ucs2_persian_ci"}, isdefault: 0b00000000},
-	145:  {alias: map[collver]string{0b01111111: "ucs2_esperanto_ci"}, isdefault: 0b00000000},
-	146:  {alias: map[collver]string{0b01111111: "ucs2_hungarian_ci"}, isdefault: 0b00000000},
-	147:  {alias: map[collver]string{0b01111111: "ucs2_sinhala_ci"}, isdefault: 0b00000000},
-	148:  {alias: map[collver]string{0b01111111: "ucs2_german2_ci"}, isdefault: 0b00000000},
-	149:  {alias: map[collver]string{0b01110000: "ucs2_croatian_ci", 0b00001111: "ucs2_croatian_mysql561_ci"}, isdefault: 0b00000000},
-	150:  {alias: map[collver]string{0b01111111: "ucs2_unicode_520_ci"}, isdefault: 0b00000000},
-	151:  {alias: map[collver]string{0b01111111: "ucs2_vietnamese_ci"}, isdefault: 0b00000000},
-	159:  {alias: map[collver]string{0b01111111: "ucs2_general_mysql500_ci"}, isdefault: 0b00000000},
-	160:  {alias: map[collver]string{0b01111111: "utf32_unicode_ci"}, isdefault: 0b00000000},
-	161:  {alias: map[collver]string{0b01111111: "utf32_icelandic_ci"}, isdefault: 0b00000000},
-	162:  {alias: map[collver]string{0b01111111: "utf32_latvian_ci"}, isdefault: 0b00000000},
-	163:  {alias: map[collver]string{0b01111111: "utf32_romanian_ci"}, isdefault: 0b00000000},
-	164:  {alias: map[collver]string{0b01111111: "utf32_slovenian_ci"}, isdefault: 0b00000000},
-	165:  {alias: map[collver]string{0b01111111: "utf32_polish_ci"}, isdefault: 0b00000000},
-	166:  {alias: map[collver]string{0b01111111: "utf32_estonian_ci"}, isdefault: 0b00000000},
-	167:  {alias: map[collver]string{0b01111111: "utf32_spanish_ci"}, isdefault: 0b00000000},
-	168:  {alias: map[collver]string{0b01111111: "utf32_swedish_ci"}, isdefault: 0b00000000},
-	169:  {alias: map[collver]string{0b01111111: "utf32_turkish_ci"}, isdefault: 0b00000000},
-	170:  {alias: map[collver]string{0b01111111: "utf32_czech_ci"}, isdefault: 0b00000000},
-	171:  {alias: map[collver]string{0b01111111: "utf32_danish_ci"}, isdefault: 0b00000000},
-	172:  {alias: map[collver]string{0b01111111: "utf32_lithuanian_ci"}, isdefault: 0b00000000},
-	173:  {alias: map[collver]string{0b01111111: "utf32_slovak_ci"}, isdefault: 0b00000000},
-	174:  {alias: map[collver]string{0b01111111: "utf32_spanish2_ci"}, isdefault: 0b00000000},
-	175:  {alias: map[collver]string{0b01111111: "utf32_roman_ci"}, isdefault: 0b00000000},
-	176:  {alias: map[collver]string{0b01111111: "utf32_persian_ci"}, isdefault: 0b00000000},
-	177:  {alias: map[collver]string{0b01111111: "utf32_esperanto_ci"}, isdefault: 0b00000000},
-	178:  {alias: map[collver]string{0b01111111: "utf32_hungarian_ci"}, isdefault: 0b00000000},
-	179:  {alias: map[collver]string{0b01111111: "utf32_sinhala_ci"}, isdefault: 0b00000000},
-	180:  {alias: map[collver]string{0b01111111: "utf32_german2_ci"}, isdefault: 0b00000000},
-	181:  {alias: map[collver]string{0b01110000: "utf32_croatian_ci", 0b00001111: "utf32_croatian_mysql561_ci"}, isdefault: 0b00000000},
-	182:  {alias: map[collver]string{0b01111111: "utf32_unicode_520_ci"}, isdefault: 0b00000000},
-	183:  {alias: map[collver]string{0b01111111: "utf32_vietnamese_ci"}, isdefault: 0b00000000},
-	192:  {alias: map[collver]string{0b01111111: "utf8_unicode_ci"}, isdefault: 0b00000000},
-	193:  {alias: map[collver]string{0b01111111: "utf8_icelandic_ci"}, isdefault: 0b00000000},
-	194:  {alias: map[collver]string{0b01111111: "utf8_latvian_ci"}, isdefault: 0b00000000},
-	195:  {alias: map[collver]string{0b01111111: "utf8_romanian_ci"}, isdefault: 0b00000000},
-	196:  {alias: map[collver]string{0b01111111: "utf8_slovenian_ci"}, isdefault: 0b00000000},
-	197:  {alias: map[collver]string{0b01111111: "utf8_polish_ci"}, isdefault: 0b00000000},
-	198:  {alias: map[collver]string{0b01111111: "utf8_estonian_ci"}, isdefault: 0b00000000},
-	199:  {alias: map[collver]string{0b01111111: "utf8_spanish_ci"}, isdefault: 0b00000000},
-	200:  {alias: map[collver]string{0b01111111: "utf8_swedish_ci"}, isdefault: 0b00000000},
-	201:  {alias: map[collver]string{0b01111111: "utf8_turkish_ci"}, isdefault: 0b00000000},
-	202:  {alias: map[collver]string{0b01111111: "utf8_czech_ci"}, isdefault: 0b00000000},
-	203:  {alias: map[collver]string{0b01111111: "utf8_danish_ci"}, isdefault: 0b00000000},
-	204:  {alias: map[collver]string{0b01111111: "utf8_lithuanian_ci"}, isdefault: 0b00000000},
-	205:  {alias: map[collver]string{0b01111111: "utf8_slovak_ci"}, isdefault: 0b00000000},
-	206:  {alias: map[collver]string{0b01111111: "utf8_spanish2_ci"}, isdefault: 0b00000000},
-	207:  {alias: map[collver]string{0b01111111: "utf8_roman_ci"}, isdefault: 0b00000000},
-	208:  {alias: map[collver]string{0b01111111: "utf8_persian_ci"}, isdefault: 0b00000000},
-	209:  {alias: map[collver]string{0b01111111: "utf8_esperanto_ci"}, isdefault: 0b00000000},
-	210:  {alias: map[collver]string{0b01111111: "utf8_hungarian_ci"}, isdefault: 0b00000000},
-	211:  {alias: map[collver]string{0b01111111: "utf8_sinhala_ci"}, isdefault: 0b00000000},
-	212:  {alias: map[collver]string{0b01111111: "utf8_german2_ci"}, isdefault: 0b00000000},
-	213:  {alias: map[collver]string{0b01110000: "utf8_croatian_ci", 0b00001111: "utf8_croatian_mysql561_ci"}, isdefault: 0b00000000},
-	214:  {alias: map[collver]string{0b01111111: "utf8_unicode_520_ci"}, isdefault: 0b00000000},
-	215:  {alias: map[collver]string{0b01111111: "utf8_vietnamese_ci"}, isdefault: 0b00000000},
-	223:  {alias: map[collver]string{0b01111111: "utf8_general_mysql500_ci"}, isdefault: 0b00000000},
-	224:  {alias: map[collver]string{0b01111111: "utf8mb4_unicode_ci"}, isdefault: 0b00000000},
-	225:  {alias: map[collver]string{0b01111111: "utf8mb4_icelandic_ci"}, isdefault: 0b00000000},
-	226:  {alias: map[collver]string{0b01111111: "utf8mb4_latvian_ci"}, isdefault: 0b00000000},
-	227:  {alias: map[collver]string{0b01111111: "utf8mb4_romanian_ci"}, isdefault: 0b00000000},
-	228:  {alias: map[collver]string{0b01111111: "utf8mb4_slovenian_ci"}, isdefault: 0b00000000},
-	229:  {alias: map[collver]string{0b01111111: "utf8mb4_polish_ci"}, isdefault: 0b00000000},
-	230:  {alias: map[collver]string{0b01111111: "utf8mb4_estonian_ci"}, isdefault: 0b00000000},
-	231:  {alias: map[collver]string{0b01111111: "utf8mb4_spanish_ci"}, isdefault: 0b00000000},
-	232:  {alias: map[collver]string{0b01111111: "utf8mb4_swedish_ci"}, isdefault: 0b00000000},
-	233:  {alias: map[collver]string{0b01111111: "utf8mb4_turkish_ci"}, isdefault: 0b00000000},
-	234:  {alias: map[collver]string{0b01111111: "utf8mb4_czech_ci"}, isdefault: 0b00000000},
-	235:  {alias: map[collver]string{0b01111111: "utf8mb4_danish_ci"}, isdefault: 0b00000000},
-	236:  {alias: map[collver]string{0b01111111: "utf8mb4_lithuanian_ci"}, isdefault: 0b00000000},
-	237:  {alias: map[collver]string{0b01111111: "utf8mb4_slovak_ci"}, isdefault: 0b00000000},
-	238:  {alias: map[collver]string{0b01111111: "utf8mb4_spanish2_ci"}, isdefault: 0b00000000},
-	239:  {alias: map[collver]string{0b01111111: "utf8mb4_roman_ci"}, isdefault: 0b00000000},
-	240:  {alias: map[collver]string{0b01111111: "utf8mb4_persian_ci"}, isdefault: 0b00000000},
-	241:  {alias: map[collver]string{0b01111111: "utf8mb4_esperanto_ci"}, isdefault: 0b00000000},
-	242:  {alias: map[collver]string{0b01111111: "utf8mb4_hungarian_ci"}, isdefault: 0b00000000},
-	243:  {alias: map[collver]string{0b01111111: "utf8mb4_sinhala_ci"}, isdefault: 0b00000000},
-	244:  {alias: map[collver]string{0b01111111: "utf8mb4_german2_ci"}, isdefault: 0b00000000},
-	245:  {alias: map[collver]string{0b01110000: "utf8mb4_croatian_ci", 0b00001111: "utf8mb4_croatian_mysql561_ci"}, isdefault: 0b00000000},
-	246:  {alias: map[collver]string{0b01111111: "utf8mb4_unicode_520_ci"}, isdefault: 0b00000000},
-	247:  {alias: map[collver]string{0b01111111: "utf8mb4_vietnamese_ci"}, isdefault: 0b00000000},
-	248:  {alias: map[collver]string{0b01100000: "gb18030_chinese_ci"}, isdefault: 0b01100000},
-	249:  {alias: map[collver]string{0b01100000: "gb18030_bin"}, isdefault: 0b00000000},
-	250:  {alias: map[collver]string{0b01100000: "gb18030_unicode_520_ci"}, isdefault: 0b00000000},
-	255:  {alias: map[collver]string{0b01000000: "utf8mb4_0900_ai_ci"}, isdefault: 0b01000000},
-	256:  {alias: map[collver]string{0b01000000: "utf8mb4_de_pb_0900_ai_ci"}, isdefault: 0b00000000},
-	257:  {alias: map[collver]string{0b01000000: "utf8mb4_is_0900_ai_ci"}, isdefault: 0b00000000},
-	258:  {alias: map[collver]string{0b01000000: "utf8mb4_lv_0900_ai_ci"}, isdefault: 0b00000000},
-	259:  {alias: map[collver]string{0b01000000: "utf8mb4_ro_0900_ai_ci"}, isdefault: 0b00000000},
-	260:  {alias: map[collver]string{0b01000000: "utf8mb4_sl_0900_ai_ci"}, isdefault: 0b00000000},
-	261:  {alias: map[collver]string{0b01000000: "utf8mb4_pl_0900_ai_ci"}, isdefault: 0b00000000},
-	262:  {alias: map[collver]string{0b01000000: "utf8mb4_et_0900_ai_ci"}, isdefault: 0b00000000},
-	263:  {alias: map[collver]string{0b01000000: "utf8mb4_es_0900_ai_ci"}, isdefault: 0b00000000},
-	264:  {alias: map[collver]string{0b01000000: "utf8mb4_sv_0900_ai_ci"}, isdefault: 0b00000000},
-	265:  {alias: map[collver]string{0b01000000: "utf8mb4_tr_0900_ai_ci"}, isdefault: 0b00000000},
-	266:  {alias: map[collver]string{0b01000000: "utf8mb4_cs_0900_ai_ci"}, isdefault: 0b00000000},
-	267:  {alias: map[collver]string{0b01000000: "utf8mb4_da_0900_ai_ci"}, isdefault: 0b00000000},
-	268:  {alias: map[collver]string{0b01000000: "utf8mb4_lt_0900_ai_ci"}, isdefault: 0b00000000},
-	269:  {alias: map[collver]string{0b01000000: "utf8mb4_sk_0900_ai_ci"}, isdefault: 0b00000000},
-	270:  {alias: map[collver]string{0b01000000: "utf8mb4_es_trad_0900_ai_ci"}, isdefault: 0b00000000},
-	271:  {alias: map[collver]string{0b01000000: "utf8mb4_la_0900_ai_ci"}, isdefault: 0b00000000},
-	273:  {alias: map[collver]string{0b01000000: "utf8mb4_eo_0900_ai_ci"}, isdefault: 0b00000000},
-	274:  {alias: map[collver]string{0b01000000: "utf8mb4_hu_0900_ai_ci"}, isdefault: 0b00000000},
-	275:  {alias: map[collver]string{0b01000000: "utf8mb4_hr_0900_ai_ci"}, isdefault: 0b00000000},
-	277:  {alias: map[collver]string{0b01000000: "utf8mb4_vi_0900_ai_ci"}, isdefault: 0b00000000},
-	278:  {alias: map[collver]string{0b01000000: "utf8mb4_0900_as_cs"}, isdefault: 0b00000000},
-	279:  {alias: map[collver]string{0b01000000: "utf8mb4_de_pb_0900_as_cs"}, isdefault: 0b00000000},
-	280:  {alias: map[collver]string{0b01000000: "utf8mb4_is_0900_as_cs"}, isdefault: 0b00000000},
-	281:  {alias: map[collver]string{0b01000000: "utf8mb4_lv_0900_as_cs"}, isdefault: 0b00000000},
-	282:  {alias: map[collver]string{0b01000000: "utf8mb4_ro_0900_as_cs"}, isdefault: 0b00000000},
-	283:  {alias: map[collver]string{0b01000000: "utf8mb4_sl_0900_as_cs"}, isdefault: 0b00000000},
-	284:  {alias: map[collver]string{0b01000000: "utf8mb4_pl_0900_as_cs"}, isdefault: 0b00000000},
-	285:  {alias: map[collver]string{0b01000000: "utf8mb4_et_0900_as_cs"}, isdefault: 0b00000000},
-	286:  {alias: map[collver]string{0b01000000: "utf8mb4_es_0900_as_cs"}, isdefault: 0b00000000},
-	287:  {alias: map[collver]string{0b01000000: "utf8mb4_sv_0900_as_cs"}, isdefault: 0b00000000},
-	288:  {alias: map[collver]string{0b01000000: "utf8mb4_tr_0900_as_cs"}, isdefault: 0b00000000},
-	289:  {alias: map[collver]string{0b01000000: "utf8mb4_cs_0900_as_cs"}, isdefault: 0b00000000},
-	290:  {alias: map[collver]string{0b01000000: "utf8mb4_da_0900_as_cs"}, isdefault: 0b00000000},
-	291:  {alias: map[collver]string{0b01000000: "utf8mb4_lt_0900_as_cs"}, isdefault: 0b00000000},
-	292:  {alias: map[collver]string{0b01000000: "utf8mb4_sk_0900_as_cs"}, isdefault: 0b00000000},
-	293:  {alias: map[collver]string{0b01000000: "utf8mb4_es_trad_0900_as_cs"}, isdefault: 0b00000000},
-	294:  {alias: map[collver]string{0b01000000: "utf8mb4_la_0900_as_cs"}, isdefault: 0b00000000},
-	296:  {alias: map[collver]string{0b01000000: "utf8mb4_eo_0900_as_cs"}, isdefault: 0b00000000},
-	297:  {alias: map[collver]string{0b01000000: "utf8mb4_hu_0900_as_cs"}, isdefault: 0b00000000},
-	298:  {alias: map[collver]string{0b01000000: "utf8mb4_hr_0900_as_cs"}, isdefault: 0b00000000},
-	300:  {alias: map[collver]string{0b01000000: "utf8mb4_vi_0900_as_cs"}, isdefault: 0b00000000},
-	303:  {alias: map[collver]string{0b01000000: "utf8mb4_ja_0900_as_cs"}, isdefault: 0b00000000},
-	304:  {alias: map[collver]string{0b01000000: "utf8mb4_ja_0900_as_cs_ks"}, isdefault: 0b00000000},
-	305:  {alias: map[collver]string{0b01000000: "utf8mb4_0900_as_ci"}, isdefault: 0b00000000},
-	306:  {alias: map[collver]string{0b01000000: "utf8mb4_ru_0900_ai_ci"}, isdefault: 0b00000000},
-	307:  {alias: map[collver]string{0b01000000: "utf8mb4_ru_0900_as_cs"}, isdefault: 0b00000000},
-	308:  {alias: map[collver]string{0b01000000: "utf8mb4_zh_0900_as_cs"}, isdefault: 0b00000000},
-	309:  {alias: map[collver]string{0b01000000: "utf8mb4_0900_bin"}, isdefault: 0b00000000},
-	576:  {alias: map[collver]string{0b00001111: "utf8_croatian_ci"}, isdefault: 0b00000000},
-	577:  {alias: map[collver]string{0b00001111: "utf8_myanmar_ci"}, isdefault: 0b00000000},
-	578:  {alias: map[collver]string{0b00001110: "utf8_thai_520_w2"}, isdefault: 0b00000000},
-	608:  {alias: map[collver]string{0b00001111: "utf8mb4_croatian_ci"}, isdefault: 0b00000000},
-	609:  {alias: map[collver]string{0b00001111: "utf8mb4_myanmar_ci"}, isdefault: 0b00000000},
-	610:  {alias: map[collver]string{0b00001110: "utf8mb4_thai_520_w2"}, isdefault: 0b00000000},
-	640:  {alias: map[collver]string{0b00001111: "ucs2_croatian_ci"}, isdefault: 0b00000000},
-	641:  {alias: map[collver]string{0b00001111: "ucs2_myanmar_ci"}, isdefault: 0b00000000},
-	642:  {alias: map[collver]string{0b00001110: "ucs2_thai_520_w2"}, isdefault: 0b00000000},
-	672:  {alias: map[collver]string{0b00001111: "utf16_croatian_ci"}, isdefault: 0b00000000},
-	673:  {alias: map[collver]string{0b00001111: "utf16_myanmar_ci"}, isdefault: 0b00000000},
-	674:  {alias: map[collver]string{0b00001110: "utf16_thai_520_w2"}, isdefault: 0b00000000},
-	736:  {alias: map[collver]string{0b00001111: "utf32_croatian_ci"}, isdefault: 0b00000000},
-	737:  {alias: map[collver]string{0b00001111: "utf32_myanmar_ci"}, isdefault: 0b00000000},
-	738:  {alias: map[collver]string{0b00001110: "utf32_thai_520_w2"}, isdefault: 0b00000000},
-	1025: {alias: map[collver]string{0b00001100: "big5_chinese_nopad_ci"}, isdefault: 0b00000000},
-	1027: {alias: map[collver]string{0b00001100: "dec8_swedish_nopad_ci"}, isdefault: 0b00000000},
-	1028: {alias: map[collver]string{0b00001100: "cp850_general_nopad_ci"}, isdefault: 0b00000000},
-	1030: {alias: map[collver]string{0b00001100: "hp8_english_nopad_ci"}, isdefault: 0b00000000},
-	1031: {alias: map[collver]string{0b00001100: "koi8r_general_nopad_ci"}, isdefault: 0b00000000},
-	1032: {alias: map[collver]string{0b00001100: "latin1_swedish_nopad_ci"}, isdefault: 0b00000000},
-	1033: {alias: map[collver]string{0b00001100: "latin2_general_nopad_ci"}, isdefault: 0b00000000},
-	1034: {alias: map[collver]string{0b00001100: "swe7_swedish_nopad_ci"}, isdefault: 0b00000000},
-	1035: {alias: map[collver]string{0b00001100: "ascii_general_nopad_ci"}, isdefault: 0b00000000},
-	1036: {alias: map[collver]string{0b00001100: "ujis_japanese_nopad_ci"}, isdefault: 0b00000000},
-	1037: {alias: map[collver]string{0b00001100: "sjis_japanese_nopad_ci"}, isdefault: 0b00000000},
-	1040: {alias: map[collver]string{0b00001100: "hebrew_general_nopad_ci"}, isdefault: 0b00000000},
-	1042: {alias: map[collver]string{0b00001100: "tis620_thai_nopad_ci"}, isdefault: 0b00000000},
-	1043: {alias: map[collver]string{0b00001100: "euckr_korean_nopad_ci"}, isdefault: 0b00000000},
-	1046: {alias: map[collver]string{0b00001100: "koi8u_general_nopad_ci"}, isdefault: 0b00000000},
-	1048: {alias: map[collver]string{0b00001100: "gb2312_chinese_nopad_ci"}, isdefault: 0b00000000},
-	1049: {alias: map[collver]string{0b00001100: "greek_general_nopad_ci"}, isdefault: 0b00000000},
-	1050: {alias: map[collver]string{0b00001100: "cp1250_general_nopad_ci"}, isdefault: 0b00000000},
-	1052: {alias: map[collver]string{0b00001100: "gbk_chinese_nopad_ci"}, isdefault: 0b00000000},
-	1054: {alias: map[collver]string{0b00001100: "latin5_turkish_nopad_ci"}, isdefault: 0b00000000},
-	1056: {alias: map[collver]string{0b00001100: "armscii8_general_nopad_ci"}, isdefault: 0b00000000},
-	1057: {alias: map[collver]string{0b00001100: "utf8_general_nopad_ci"}, isdefault: 0b00000000},
-	1059: {alias: map[collver]string{0b00001100: "ucs2_general_nopad_ci"}, isdefault: 0b00000000},
-	1060: {alias: map[collver]string{0b00001100: "cp866_general_nopad_ci"}, isdefault: 0b00000000},
-	1061: {alias: map[collver]string{0b00001100: "keybcs2_general_nopad_ci"}, isdefault: 0b00000000},
-	1062: {alias: map[collver]string{0b00001100: "macce_general_nopad_ci"}, isdefault: 0b00000000},
-	1063: {alias: map[collver]string{0b00001100: "macroman_general_nopad_ci"}, isdefault: 0b00000000},
-	1064: {alias: map[collver]string{0b00001100: "cp852_general_nopad_ci"}, isdefault: 0b00000000},
-	1065: {alias: map[collver]string{0b00001100: "latin7_general_nopad_ci"}, isdefault: 0b00000000},
-	1067: {alias: map[collver]string{0b00001100: "macce_nopad_bin"}, isdefault: 0b00000000},
-	1069: {alias: map[collver]string{0b00001100: "utf8mb4_general_nopad_ci"}, isdefault: 0b00000000},
-	1070: {alias: map[collver]string{0b00001100: "utf8mb4_nopad_bin"}, isdefault: 0b00000000},
-	1071: {alias: map[collver]string{0b00001100: "latin1_nopad_bin"}, isdefault: 0b00000000},
-	1074: {alias: map[collver]string{0b00001100: "cp1251_nopad_bin"}, isdefault: 0b00000000},
-	1075: {alias: map[collver]string{0b00001100: "cp1251_general_nopad_ci"}, isdefault: 0b00000000},
-	1077: {alias: map[collver]string{0b00001100: "macroman_nopad_bin"}, isdefault: 0b00000000},
-	1078: {alias: map[collver]string{0b00001100: "utf16_general_nopad_ci"}, isdefault: 0b00000000},
-	1079: {alias: map[collver]string{0b00001100: "utf16_nopad_bin"}, isdefault: 0b00000000},
-	1080: {alias: map[collver]string{0b00001100: "utf16le_general_nopad_ci"}, isdefault: 0b00000000},
-	1081: {alias: map[collver]string{0b00001100: "cp1256_general_nopad_ci"}, isdefault: 0b00000000},
-	1082: {alias: map[collver]string{0b00001100: "cp1257_nopad_bin"}, isdefault: 0b00000000},
-	1083: {alias: map[collver]string{0b00001100: "cp1257_general_nopad_ci"}, isdefault: 0b00000000},
-	1084: {alias: map[collver]string{0b00001100: "utf32_general_nopad_ci"}, isdefault: 0b00000000},
-	1085: {alias: map[collver]string{0b00001100: "utf32_nopad_bin"}, isdefault: 0b00000000},
-	1086: {alias: map[collver]string{0b00001100: "utf16le_nopad_bin"}, isdefault: 0b00000000},
-	1088: {alias: map[collver]string{0b00001100: "armscii8_nopad_bin"}, isdefault: 0b00000000},
-	1089: {alias: map[collver]string{0b00001100: "ascii_nopad_bin"}, isdefault: 0b00000000},
-	1090: {alias: map[collver]string{0b00001100: "cp1250_nopad_bin"}, isdefault: 0b00000000},
-	1091: {alias: map[collver]string{0b00001100: "cp1256_nopad_bin"}, isdefault: 0b00000000},
-	1092: {alias: map[collver]string{0b00001100: "cp866_nopad_bin"}, isdefault: 0b00000000},
-	1093: {alias: map[collver]string{0b00001100: "dec8_nopad_bin"}, isdefault: 0b00000000},
-	1094: {alias: map[collver]string{0b00001100: "greek_nopad_bin"}, isdefault: 0b00000000},
-	1095: {alias: map[collver]string{0b00001100: "hebrew_nopad_bin"}, isdefault: 0b00000000},
-	1096: {alias: map[collver]string{0b00001100: "hp8_nopad_bin"}, isdefault: 0b00000000},
-	1097: {alias: map[collver]string{0b00001100: "keybcs2_nopad_bin"}, isdefault: 0b00000000},
-	1098: {alias: map[collver]string{0b00001100: "koi8r_nopad_bin"}, isdefault: 0b00000000},
-	1099: {alias: map[collver]string{0b00001100: "koi8u_nopad_bin"}, isdefault: 0b00000000},
-	1101: {alias: map[collver]string{0b00001100: "latin2_nopad_bin"}, isdefault: 0b00000000},
-	1102: {alias: map[collver]string{0b00001100: "latin5_nopad_bin"}, isdefault: 0b00000000},
-	1103: {alias: map[collver]string{0b00001100: "latin7_nopad_bin"}, isdefault: 0b00000000},
-	1104: {alias: map[collver]string{0b00001100: "cp850_nopad_bin"}, isdefault: 0b00000000},
-	1105: {alias: map[collver]string{0b00001100: "cp852_nopad_bin"}, isdefault: 0b00000000},
-	1106: {alias: map[collver]string{0b00001100: "swe7_nopad_bin"}, isdefault: 0b00000000},
-	1107: {alias: map[collver]string{0b00001100: "utf8_nopad_bin"}, isdefault: 0b00000000},
-	1108: {alias: map[collver]string{0b00001100: "big5_nopad_bin"}, isdefault: 0b00000000},
-	1109: {alias: map[collver]string{0b00001100: "euckr_nopad_bin"}, isdefault: 0b00000000},
-	1110: {alias: map[collver]string{0b00001100: "gb2312_nopad_bin"}, isdefault: 0b00000000},
-	1111: {alias: map[collver]string{0b00001100: "gbk_nopad_bin"}, isdefault: 0b00000000},
-	1112: {alias: map[collver]string{0b00001100: "sjis_nopad_bin"}, isdefault: 0b00000000},
-	1113: {alias: map[collver]string{0b00001100: "tis620_nopad_bin"}, isdefault: 0b00000000},
-	1114: {alias: map[collver]string{0b00001100: "ucs2_nopad_bin"}, isdefault: 0b00000000},
-	1115: {alias: map[collver]string{0b00001100: "ujis_nopad_bin"}, isdefault: 0b00000000},
-	1116: {alias: map[collver]string{0b00001100: "geostd8_general_nopad_ci"}, isdefault: 0b00000000},
-	1117: {alias: map[collver]string{0b00001100: "geostd8_nopad_bin"}, isdefault: 0b00000000},
-	1119: {alias: map[collver]string{0b00001100: "cp932_japanese_nopad_ci"}, isdefault: 0b00000000},
-	1120: {alias: map[collver]string{0b00001100: "cp932_nopad_bin"}, isdefault: 0b00000000},
-	1121: {alias: map[collver]string{0b00001100: "eucjpms_japanese_nopad_ci"}, isdefault: 0b00000000},
-	1122: {alias: map[collver]string{0b00001100: "eucjpms_nopad_bin"}, isdefault: 0b00000000},
-	1125: {alias: map[collver]string{0b00001100: "utf16_unicode_nopad_ci"}, isdefault: 0b00000000},
-	1147: {alias: map[collver]string{0b00001100: "utf16_unicode_520_nopad_ci"}, isdefault: 0b00000000},
-	1152: {alias: map[collver]string{0b00001100: "ucs2_unicode_nopad_ci"}, isdefault: 0b00000000},
-	1174: {alias: map[collver]string{0b00001100: "ucs2_unicode_520_nopad_ci"}, isdefault: 0b00000000},
-	1184: {alias: map[collver]string{0b00001100: "utf32_unicode_nopad_ci"}, isdefault: 0b00000000},
-	1206: {alias: map[collver]string{0b00001100: "utf32_unicode_520_nopad_ci"}, isdefault: 0b00000000},
-	1216: {alias: map[collver]string{0b00001100: "utf8_unicode_nopad_ci"}, isdefault: 0b00000000},
-	1238: {alias: map[collver]string{0b00001100: "utf8_unicode_520_nopad_ci"}, isdefault: 0b00000000},
-	1248: {alias: map[collver]string{0b00001100: "utf8mb4_unicode_nopad_ci"}, isdefault: 0b00000000},
-	1270: {alias: map[collver]string{0b00001100: "utf8mb4_unicode_520_nopad_ci"}, isdefault: 0b00000000},
+	1:    {alias: []collalias{{0b01111111, "big5_chinese_ci"}}, isdefault: 0b01111111},
+	2:    {alias: []collalias{{0b01111111, "latin2_czech_cs"}}, isdefault: 0b00000000},
+	3:    {alias: []collalias{{0b01111111, "dec8_swedish_ci"}}, isdefault: 0b01111111},
+	4:    {alias: []collalias{{0b01111111, "cp850_general_ci"}}, isdefault: 0b01111111},
+	5:    {alias: []collalias{{0b01111111, "latin1_german1_ci"}}, isdefault: 0b00000000},
+	6:    {alias: []collalias{{0b01111111, "hp8_english_ci"}}, isdefault: 0b01111111},
+	7:    {alias: []collalias{{0b01111111, "koi8r_general_ci"}}, isdefault: 0b01111111},
+	8:    {alias: []collalias{{0b01111111, "latin1_swedish_ci"}}, isdefault: 0b01111111},
+	9:    {alias: []collalias{{0b01111111, "latin2_general_ci"}}, isdefault: 0b01111111},
+	10:   {alias: []collalias{{0b01111111, "swe7_swedish_ci"}}, isdefault: 0b01111111},
+	11:   {alias: []collalias{{0b01111111, "ascii_general_ci"}}, isdefault: 0b01111111},
+	12:   {alias: []collalias{{0b01111111, "ujis_japanese_ci"}}, isdefault: 0b01111111},
+	13:   {alias: []collalias{{0b01111111, "sjis_japanese_ci"}}, isdefault: 0b01111111},
+	14:   {alias: []collalias{{0b01111111, "cp1251_bulgarian_ci"}}, isdefault: 0b00000000},
+	15:   {alias: []collalias{{0b01111111, "latin1_danish_ci"}}, isdefault: 0b00000000},
+	16:   {alias: []collalias{{0b01111111, "hebrew_general_ci"}}, isdefault: 0b01111111},
+	18:   {alias: []collalias{{0b01111111, "tis620_thai_ci"}}, isdefault: 0b01111111},
+	19:   {alias: []collalias{{0b01111111, "euckr_korean_ci"}}, isdefault: 0b01111111},
+	20:   {alias: []collalias{{0b01111111, "latin7_estonian_cs"}}, isdefault: 0b00000000},
+	21:   {alias: []collalias{{0b01111111, "latin2_hungarian_ci"}}, isdefault: 0b00000000},
+	22:   {alias: []collalias{{0b01111111, "koi8u_general_ci"}}, isdefault: 0b01111111},
+	23:   {alias: []collalias{{0b01111111, "cp1251_ukrainian_ci"}}, isdefault: 0b00000000},
+	24:   {alias: []collalias{{0b01111111, "gb2312_chinese_ci"}}, isdefault: 0b01111111},
+	25:   {alias: []collalias{{0b01111111, "greek_general_ci"}}, isdefault: 0b01111111},
+	26:   {alias: []collalias{{0b01111111, "cp1250_general_ci"}}, isdefault: 0b01111111},
+	27:   {alias: []collalias{{0b01111111, "latin2_croatian_ci"}}, isdefault: 0b00000000},
+	28:   {alias: []collalias{{0b01111111, "gbk_chinese_ci"}}, isdefault: 0b01111111},
+	29:   {alias: []collalias{{0b01111111, "cp1257_lithuanian_ci"}}, isdefault: 0b00000000},
+	30:   {alias: []collalias{{0b01111111, "latin5_turkish_ci"}}, isdefault: 0b01111111},
+	31:   {alias: []collalias{{0b01111111, "latin1_german2_ci"}}, isdefault: 0b00000000},
+	32:   {alias: []collalias{{0b01111111, "armscii8_general_ci"}}, isdefault: 0b01111111},
+	33:   {alias: []collalias{{0b01111111, "utf8_general_ci"}, {0b01111111, "utf8mb3_general_ci"}}, isdefault: 0b01111111},
+	34:   {alias: []collalias{{0b01111111, "cp1250_czech_cs"}}, isdefault: 0b00000000},
+	35:   {alias: []collalias{{0b01111111, "ucs2_general_ci"}}, isdefault: 0b01111111},
+	36:   {alias: []collalias{{0b01111111, "cp866_general_ci"}}, isdefault: 0b01111111},
+	37:   {alias: []collalias{{0b01111111, "keybcs2_general_ci"}}, isdefault: 0b01111111},
+	38:   {alias: []collalias{{0b01111111, "macce_general_ci"}}, isdefault: 0b01111111},
+	39:   {alias: []collalias{{0b01111111, "macroman_general_ci"}}, isdefault: 0b01111111},
+	40:   {alias: []collalias{{0b01111111, "cp852_general_ci"}}, isdefault: 0b01111111},
+	41:   {alias: []collalias{{0b01111111, "latin7_general_ci"}}, isdefault: 0b01111111},
+	42:   {alias: []collalias{{0b01111111, "latin7_general_cs"}}, isdefault: 0b00000000},
+	43:   {alias: []collalias{{0b01111111, "macce_bin"}}, isdefault: 0b00000000},
+	44:   {alias: []collalias{{0b01111111, "cp1250_croatian_ci"}}, isdefault: 0b00000000},
+	45:   {alias: []collalias{{0b01111111, "utf8mb4_general_ci"}}, isdefault: 0b00111111},
+	46:   {alias: []collalias{{0b01111111, "utf8mb4_bin"}}, isdefault: 0b00000000},
+	47:   {alias: []collalias{{0b01111111, "latin1_bin"}}, isdefault: 0b00000000},
+	48:   {alias: []collalias{{0b01111111, "latin1_general_ci"}}, isdefault: 0b00000000},
+	49:   {alias: []collalias{{0b01111111, "latin1_general_cs"}}, isdefault: 0b00000000},
+	50:   {alias: []collalias{{0b01111111, "cp1251_bin"}}, isdefault: 0b00000000},
+	51:   {alias: []collalias{{0b01111111, "cp1251_general_ci"}}, isdefault: 0b01111111},
+	52:   {alias: []collalias{{0b01111111, "cp1251_general_cs"}}, isdefault: 0b00000000},
+	53:   {alias: []collalias{{0b01111111, "macroman_bin"}}, isdefault: 0b00000000},
+	54:   {alias: []collalias{{0b01111111, "utf16_general_ci"}}, isdefault: 0b01111111},
+	55:   {alias: []collalias{{0b01111111, "utf16_bin"}}, isdefault: 0b00000000},
+	56:   {alias: []collalias{{0b01111111, "utf16le_general_ci"}}, isdefault: 0b01111111},
+	57:   {alias: []collalias{{0b01111111, "cp1256_general_ci"}}, isdefault: 0b01111111},
+	58:   {alias: []collalias{{0b01111111, "cp1257_bin"}}, isdefault: 0b00000000},
+	59:   {alias: []collalias{{0b01111111, "cp1257_general_ci"}}, isdefault: 0b01111111},
+	60:   {alias: []collalias{{0b01111111, "utf32_general_ci"}}, isdefault: 0b01111111},
+	61:   {alias: []collalias{{0b01111111, "utf32_bin"}}, isdefault: 0b00000000},
+	62:   {alias: []collalias{{0b01111111, "utf16le_bin"}}, isdefault: 0b00000000},
+	63:   {alias: []collalias{{0b01111111, "binary"}}, isdefault: 0b01111111},
+	64:   {alias: []collalias{{0b01111111, "armscii8_bin"}}, isdefault: 0b00000000},
+	65:   {alias: []collalias{{0b01111111, "ascii_bin"}}, isdefault: 0b00000000},
+	66:   {alias: []collalias{{0b01111111, "cp1250_bin"}}, isdefault: 0b00000000},
+	67:   {alias: []collalias{{0b01111111, "cp1256_bin"}}, isdefault: 0b00000000},
+	68:   {alias: []collalias{{0b01111111, "cp866_bin"}}, isdefault: 0b00000000},
+	69:   {alias: []collalias{{0b01111111, "dec8_bin"}}, isdefault: 0b00000000},
+	70:   {alias: []collalias{{0b01111111, "greek_bin"}}, isdefault: 0b00000000},
+	71:   {alias: []collalias{{0b01111111, "hebrew_bin"}}, isdefault: 0b00000000},
+	72:   {alias: []collalias{{0b01111111, "hp8_bin"}}, isdefault: 0b00000000},
+	73:   {alias: []collalias{{0b01111111, "keybcs2_bin"}}, isdefault: 0b00000000},
+	74:   {alias: []collalias{{0b01111111, "koi8r_bin"}}, isdefault: 0b00000000},
+	75:   {alias: []collalias{{0b01111111, "koi8u_bin"}}, isdefault: 0b00000000},
+	76:   {alias: []collalias{{0b01000000, "utf8_tolower_ci"}, {0b01000000, "utf8mb3_tolower_ci"}}, isdefault: 0b00000000},
+	77:   {alias: []collalias{{0b01111111, "latin2_bin"}}, isdefault: 0b00000000},
+	78:   {alias: []collalias{{0b01111111, "latin5_bin"}}, isdefault: 0b00000000},
+	79:   {alias: []collalias{{0b01111111, "latin7_bin"}}, isdefault: 0b00000000},
+	80:   {alias: []collalias{{0b01111111, "cp850_bin"}}, isdefault: 0b00000000},
+	81:   {alias: []collalias{{0b01111111, "cp852_bin"}}, isdefault: 0b00000000},
+	82:   {alias: []collalias{{0b01111111, "swe7_bin"}}, isdefault: 0b00000000},
+	83:   {alias: []collalias{{0b01111111, "utf8_bin"}, {0b01111111, "utf8mb3_bin"}}, isdefault: 0b00000000},
+	84:   {alias: []collalias{{0b01111111, "big5_bin"}}, isdefault: 0b00000000},
+	85:   {alias: []collalias{{0b01111111, "euckr_bin"}}, isdefault: 0b00000000},
+	86:   {alias: []collalias{{0b01111111, "gb2312_bin"}}, isdefault: 0b00000000},
+	87:   {alias: []collalias{{0b01111111, "gbk_bin"}}, isdefault: 0b00000000},
+	88:   {alias: []collalias{{0b01111111, "sjis_bin"}}, isdefault: 0b00000000},
+	89:   {alias: []collalias{{0b01111111, "tis620_bin"}}, isdefault: 0b00000000},
+	90:   {alias: []collalias{{0b01111111, "ucs2_bin"}}, isdefault: 0b00000000},
+	91:   {alias: []collalias{{0b01111111, "ujis_bin"}}, isdefault: 0b00000000},
+	92:   {alias: []collalias{{0b01111111, "geostd8_general_ci"}}, isdefault: 0b01111111},
+	93:   {alias: []collalias{{0b01111111, "geostd8_bin"}}, isdefault: 0b00000000},
+	94:   {alias: []collalias{{0b01111111, "latin1_spanish_ci"}}, isdefault: 0b00000000},
+	95:   {alias: []collalias{{0b01111111, "cp932_japanese_ci"}}, isdefault: 0b01111111},
+	96:   {alias: []collalias{{0b01111111, "cp932_bin"}}, isdefault: 0b00000000},
+	97:   {alias: []collalias{{0b01111111, "eucjpms_japanese_ci"}}, isdefault: 0b01111111},
+	98:   {alias: []collalias{{0b01111111, "eucjpms_bin"}}, isdefault: 0b00000000},
+	99:   {alias: []collalias{{0b01111111, "cp1250_polish_ci"}}, isdefault: 0b00000000},
+	101:  {alias: []collalias{{0b01111111, "utf16_unicode_ci"}}, isdefault: 0b00000000},
+	102:  {alias: []collalias{{0b01111111, "utf16_icelandic_ci"}}, isdefault: 0b00000000},
+	103:  {alias: []collalias{{0b01111111, "utf16_latvian_ci"}}, isdefault: 0b00000000},
+	104:  {alias: []collalias{{0b01111111, "utf16_romanian_ci"}}, isdefault: 0b00000000},
+	105:  {alias: []collalias{{0b01111111, "utf16_slovenian_ci"}}, isdefault: 0b00000000},
+	106:  {alias: []collalias{{0b01111111, "utf16_polish_ci"}}, isdefault: 0b00000000},
+	107:  {alias: []collalias{{0b01111111, "utf16_estonian_ci"}}, isdefault: 0b00000000},
+	108:  {alias: []collalias{{0b01111111, "utf16_spanish_ci"}}, isdefault: 0b00000000},
+	109:  {alias: []collalias{{0b01111111, "utf16_swedish_ci"}}, isdefault: 0b00000000},
+	110:  {alias: []collalias{{0b01111111, "utf16_turkish_ci"}}, isdefault: 0b00000000},
+	111:  {alias: []collalias{{0b01111111, "utf16_czech_ci"}}, isdefault: 0b00000000},
+	112:  {alias: []collalias{{0b01111111, "utf16_danish_ci"}}, isdefault: 0b00000000},
+	113:  {alias: []collalias{{0b01111111, "utf16_lithuanian_ci"}}, isdefault: 0b00000000},
+	114:  {alias: []collalias{{0b01111111, "utf16_slovak_ci"}}, isdefault: 0b00000000},
+	115:  {alias: []collalias{{0b01111111, "utf16_spanish2_ci"}}, isdefault: 0b00000000},
+	116:  {alias: []collalias{{0b01111111, "utf16_roman_ci"}}, isdefault: 0b00000000},
+	117:  {alias: []collalias{{0b01111111, "utf16_persian_ci"}}, isdefault: 0b00000000},
+	118:  {alias: []collalias{{0b01111111, "utf16_esperanto_ci"}}, isdefault: 0b00000000},
+	119:  {alias: []collalias{{0b01111111, "utf16_hungarian_ci"}}, isdefault: 0b00000000},
+	120:  {alias: []collalias{{0b01111111, "utf16_sinhala_ci"}}, isdefault: 0b00000000},
+	121:  {alias: []collalias{{0b01111111, "utf16_german2_ci"}}, isdefault: 0b00000000},
+	122:  {alias: []collalias{{0b01110000, "utf16_croatian_ci"}, {0b00001111, "utf16_croatian_mysql561_ci"}}, isdefault: 0b00000000},
+	123:  {alias: []collalias{{0b01111111, "utf16_unicode_520_ci"}}, isdefault: 0b00000000},
+	124:  {alias: []collalias{{0b01111111, "utf16_vietnamese_ci"}}, isdefault: 0b00000000},
+	128:  {alias: []collalias{{0b01111111, "ucs2_unicode_ci"}}, isdefault: 0b00000000},
+	129:  {alias: []collalias{{0b01111111, "ucs2_icelandic_ci"}}, isdefault: 0b00000000},
+	130:  {alias: []collalias{{0b01111111, "ucs2_latvian_ci"}}, isdefault: 0b00000000},
+	131:  {alias: []collalias{{0b01111111, "ucs2_romanian_ci"}}, isdefault: 0b00000000},
+	132:  {alias: []collalias{{0b01111111, "ucs2_slovenian_ci"}}, isdefault: 0b00000000},
+	133:  {alias: []collalias{{0b01111111, "ucs2_polish_ci"}}, isdefault: 0b00000000},
+	134:  {alias: []collalias{{0b01111111, "ucs2_estonian_ci"}}, isdefault: 0b00000000},
+	135:  {alias: []collalias{{0b01111111, "ucs2_spanish_ci"}}, isdefault: 0b00000000},
+	136:  {alias: []collalias{{0b01111111, "ucs2_swedish_ci"}}, isdefault: 0b00000000},
+	137:  {alias: []collalias{{0b01111111, "ucs2_turkish_ci"}}, isdefault: 0b00000000},
+	138:  {alias: []collalias{{0b01111111, "ucs2_czech_ci"}}, isdefault: 0b00000000},
+	139:  {alias: []collalias{{0b01111111, "ucs2_danish_ci"}}, isdefault: 0b00000000},
+	140:  {alias: []collalias{{0b01111111, "ucs2_lithuanian_ci"}}, isdefault: 0b00000000},
+	141:  {alias: []collalias{{0b01111111, "ucs2_slovak_ci"}}, isdefault: 0b00000000},
+	142:  {alias: []collalias{{0b01111111, "ucs2_spanish2_ci"}}, isdefault: 0b00000000},
+	143:  {alias: []collalias{{0b01111111, "ucs2_roman_ci"}}, isdefault: 0b00000000},
+	144:  {alias: []collalias{{0b01111111, "ucs2_persian_ci"}}, isdefault: 0b00000000},
+	145:  {alias: []collalias{{0b01111111, "ucs2_esperanto_ci"}}, isdefault: 0b00000000},
+	146:  {alias: []collalias{{0b01111111, "ucs2_hungarian_ci"}}, isdefault: 0b00000000},
+	147:  {alias: []collalias{{0b01111111, "ucs2_sinhala_ci"}}, isdefault: 0b00000000},
+	148:  {alias: []collalias{{0b01111111, "ucs2_german2_ci"}}, isdefault: 0b00000000},
+	149:  {alias: []collalias{{0b01110000, "ucs2_croatian_ci"}, {0b00001111, "ucs2_croatian_mysql561_ci"}}, isdefault: 0b00000000},
+	150:  {alias: []collalias{{0b01111111, "ucs2_unicode_520_ci"}}, isdefault: 0b00000000},
+	151:  {alias: []collalias{{0b01111111, "ucs2_vietnamese_ci"}}, isdefault: 0b00000000},
+	159:  {alias: []collalias{{0b01111111, "ucs2_general_mysql500_ci"}}, isdefault: 0b00000000},
+	160:  {alias: []collalias{{0b01111111, "utf32_unicode_ci"}}, isdefault: 0b00000000},
+	161:  {alias: []collalias{{0b01111111, "utf32_icelandic_ci"}}, isdefault: 0b00000000},
+	162:  {alias: []collalias{{0b01111111, "utf32_latvian_ci"}}, isdefault: 0b00000000},
+	163:  {alias: []collalias{{0b01111111, "utf32_romanian_ci"}}, isdefault: 0b00000000},
+	164:  {alias: []collalias{{0b01111111, "utf32_slovenian_ci"}}, isdefault: 0b00000000},
+	165:  {alias: []collalias{{0b01111111, "utf32_polish_ci"}}, isdefault: 0b00000000},
+	166:  {alias: []collalias{{0b01111111, "utf32_estonian_ci"}}, isdefault: 0b00000000},
+	167:  {alias: []collalias{{0b01111111, "utf32_spanish_ci"}}, isdefault: 0b00000000},
+	168:  {alias: []collalias{{0b01111111, "utf32_swedish_ci"}}, isdefault: 0b00000000},
+	169:  {alias: []collalias{{0b01111111, "utf32_turkish_ci"}}, isdefault: 0b00000000},
+	170:  {alias: []collalias{{0b01111111, "utf32_czech_ci"}}, isdefault: 0b00000000},
+	171:  {alias: []collalias{{0b01111111, "utf32_danish_ci"}}, isdefault: 0b00000000},
+	172:  {alias: []collalias{{0b01111111, "utf32_lithuanian_ci"}}, isdefault: 0b00000000},
+	173:  {alias: []collalias{{0b01111111, "utf32_slovak_ci"}}, isdefault: 0b00000000},
+	174:  {alias: []collalias{{0b01111111, "utf32_spanish2_ci"}}, isdefault: 0b00000000},
+	175:  {alias: []collalias{{0b01111111, "utf32_roman_ci"}}, isdefault: 0b00000000},
+	176:  {alias: []collalias{{0b01111111, "utf32_persian_ci"}}, isdefault: 0b00000000},
+	177:  {alias: []collalias{{0b01111111, "utf32_esperanto_ci"}}, isdefault: 0b00000000},
+	178:  {alias: []collalias{{0b01111111, "utf32_hungarian_ci"}}, isdefault: 0b00000000},
+	179:  {alias: []collalias{{0b01111111, "utf32_sinhala_ci"}}, isdefault: 0b00000000},
+	180:  {alias: []collalias{{0b01111111, "utf32_german2_ci"}}, isdefault: 0b00000000},
+	181:  {alias: []collalias{{0b01110000, "utf32_croatian_ci"}, {0b00001111, "utf32_croatian_mysql561_ci"}}, isdefault: 0b00000000},
+	182:  {alias: []collalias{{0b01111111, "utf32_unicode_520_ci"}}, isdefault: 0b00000000},
+	183:  {alias: []collalias{{0b01111111, "utf32_vietnamese_ci"}}, isdefault: 0b00000000},
+	192:  {alias: []collalias{{0b01111111, "utf8_unicode_ci"}, {0b01111111, "utf8mb3_unicode_ci"}}, isdefault: 0b00000000},
+	193:  {alias: []collalias{{0b01111111, "utf8_icelandic_ci"}, {0b01111111, "utf8mb3_icelandic_ci"}}, isdefault: 0b00000000},
+	194:  {alias: []collalias{{0b01111111, "utf8_latvian_ci"}, {0b01111111, "utf8mb3_latvian_ci"}}, isdefault: 0b00000000},
+	195:  {alias: []collalias{{0b01111111, "utf8_romanian_ci"}, {0b01111111, "utf8mb3_romanian_ci"}}, isdefault: 0b00000000},
+	196:  {alias: []collalias{{0b01111111, "utf8_slovenian_ci"}, {0b01111111, "utf8mb3_slovenian_ci"}}, isdefault: 0b00000000},
+	197:  {alias: []collalias{{0b01111111, "utf8_polish_ci"}, {0b01111111, "utf8mb3_polish_ci"}}, isdefault: 0b00000000},
+	198:  {alias: []collalias{{0b01111111, "utf8_estonian_ci"}, {0b01111111, "utf8mb3_estonian_ci"}}, isdefault: 0b00000000},
+	199:  {alias: []collalias{{0b01111111, "utf8_spanish_ci"}, {0b01111111, "utf8mb3_spanish_ci"}}, isdefault: 0b00000000},
+	200:  {alias: []collalias{{0b01111111, "utf8_swedish_ci"}, {0b01111111, "utf8mb3_swedish_ci"}}, isdefault: 0b00000000},
+	201:  {alias: []collalias{{0b01111111, "utf8_turkish_ci"}, {0b01111111, "utf8mb3_turkish_ci"}}, isdefault: 0b00000000},
+	202:  {alias: []collalias{{0b01111111, "utf8_czech_ci"}, {0b01111111, "utf8mb3_czech_ci"}}, isdefault: 0b00000000},
+	203:  {alias: []collalias{{0b01111111, "utf8_danish_ci"}, {0b01111111, "utf8mb3_danish_ci"}}, isdefault: 0b00000000},
+	204:  {alias: []collalias{{0b01111111, "utf8_lithuanian_ci"}, {0b01111111, "utf8mb3_lithuanian_ci"}}, isdefault: 0b00000000},
+	205:  {alias: []collalias{{0b01111111, "utf8_slovak_ci"}, {0b01111111, "utf8mb3_slovak_ci"}}, isdefault: 0b00000000},
+	206:  {alias: []collalias{{0b01111111, "utf8_spanish2_ci"}, {0b01111111, "utf8mb3_spanish2_ci"}}, isdefault: 0b00000000},
+	207:  {alias: []collalias{{0b01111111, "utf8_roman_ci"}, {0b01111111, "utf8mb3_roman_ci"}}, isdefault: 0b00000000},
+	208:  {alias: []collalias{{0b01111111, "utf8_persian_ci"}, {0b01111111, "utf8mb3_persian_ci"}}, isdefault: 0b00000000},
+	209:  {alias: []collalias{{0b01111111, "utf8_esperanto_ci"}, {0b01111111, "utf8mb3_esperanto_ci"}}, isdefault: 0b00000000},
+	210:  {alias: []collalias{{0b01111111, "utf8_hungarian_ci"}, {0b01111111, "utf8mb3_hungarian_ci"}}, isdefault: 0b00000000},
+	211:  {alias: []collalias{{0b01111111, "utf8_sinhala_ci"}, {0b01111111, "utf8mb3_sinhala_ci"}}, isdefault: 0b00000000},
+	212:  {alias: []collalias{{0b01111111, "utf8_german2_ci"}, {0b01111111, "utf8mb3_german2_ci"}}, isdefault: 0b00000000},
+	213:  {alias: []collalias{{0b01110000, "utf8_croatian_ci"}, {0b00001111, "utf8_croatian_mysql561_ci"}, {0b01110000, "utf8mb3_croatian_ci"}, {0b00001111, "utf8mb3_croatian_mysql561_ci"}}, isdefault: 0b00000000},
+	214:  {alias: []collalias{{0b01111111, "utf8_unicode_520_ci"}, {0b01111111, "utf8mb3_unicode_520_ci"}}, isdefault: 0b00000000},
+	215:  {alias: []collalias{{0b01111111, "utf8_vietnamese_ci"}, {0b01111111, "utf8mb3_vietnamese_ci"}}, isdefault: 0b00000000},
+	223:  {alias: []collalias{{0b01111111, "utf8_general_mysql500_ci"}, {0b01111111, "utf8mb3_general_mysql500_ci"}}, isdefault: 0b00000000},
+	224:  {alias: []collalias{{0b01111111, "utf8mb4_unicode_ci"}}, isdefault: 0b00000000},
+	225:  {alias: []collalias{{0b01111111, "utf8mb4_icelandic_ci"}}, isdefault: 0b00000000},
+	226:  {alias: []collalias{{0b01111111, "utf8mb4_latvian_ci"}}, isdefault: 0b00000000},
+	227:  {alias: []collalias{{0b01111111, "utf8mb4_romanian_ci"}}, isdefault: 0b00000000},
+	228:  {alias: []collalias{{0b01111111, "utf8mb4_slovenian_ci"}}, isdefault: 0b00000000},
+	229:  {alias: []collalias{{0b01111111, "utf8mb4_polish_ci"}}, isdefault: 0b00000000},
+	230:  {alias: []collalias{{0b01111111, "utf8mb4_estonian_ci"}}, isdefault: 0b00000000},
+	231:  {alias: []collalias{{0b01111111, "utf8mb4_spanish_ci"}}, isdefault: 0b00000000},
+	232:  {alias: []collalias{{0b01111111, "utf8mb4_swedish_ci"}}, isdefault: 0b00000000},
+	233:  {alias: []collalias{{0b01111111, "utf8mb4_turkish_ci"}}, isdefault: 0b00000000},
+	234:  {alias: []collalias{{0b01111111, "utf8mb4_czech_ci"}}, isdefault: 0b00000000},
+	235:  {alias: []collalias{{0b01111111, "utf8mb4_danish_ci"}}, isdefault: 0b00000000},
+	236:  {alias: []collalias{{0b01111111, "utf8mb4_lithuanian_ci"}}, isdefault: 0b00000000},
+	237:  {alias: []collalias{{0b01111111, "utf8mb4_slovak_ci"}}, isdefault: 0b00000000},
+	238:  {alias: []collalias{{0b01111111, "utf8mb4_spanish2_ci"}}, isdefault: 0b00000000},
+	239:  {alias: []collalias{{0b01111111, "utf8mb4_roman_ci"}}, isdefault: 0b00000000},
+	240:  {alias: []collalias{{0b01111111, "utf8mb4_persian_ci"}}, isdefault: 0b00000000},
+	241:  {alias: []collalias{{0b01111111, "utf8mb4_esperanto_ci"}}, isdefault: 0b00000000},
+	242:  {alias: []collalias{{0b01111111, "utf8mb4_hungarian_ci"}}, isdefault: 0b00000000},
+	243:  {alias: []collalias{{0b01111111, "utf8mb4_sinhala_ci"}}, isdefault: 0b00000000},
+	244:  {alias: []collalias{{0b01111111, "utf8mb4_german2_ci"}}, isdefault: 0b00000000},
+	245:  {alias: []collalias{{0b01110000, "utf8mb4_croatian_ci"}, {0b00001111, "utf8mb4_croatian_mysql561_ci"}}, isdefault: 0b00000000},
+	246:  {alias: []collalias{{0b01111111, "utf8mb4_unicode_520_ci"}}, isdefault: 0b00000000},
+	247:  {alias: []collalias{{0b01111111, "utf8mb4_vietnamese_ci"}}, isdefault: 0b00000000},
+	248:  {alias: []collalias{{0b01100000, "gb18030_chinese_ci"}}, isdefault: 0b01100000},
+	249:  {alias: []collalias{{0b01100000, "gb18030_bin"}}, isdefault: 0b00000000},
+	250:  {alias: []collalias{{0b01100000, "gb18030_unicode_520_ci"}}, isdefault: 0b00000000},
+	255:  {alias: []collalias{{0b01000000, "utf8mb4_0900_ai_ci"}}, isdefault: 0b01000000},
+	256:  {alias: []collalias{{0b01000000, "utf8mb4_de_pb_0900_ai_ci"}}, isdefault: 0b00000000},
+	257:  {alias: []collalias{{0b01000000, "utf8mb4_is_0900_ai_ci"}}, isdefault: 0b00000000},
+	258:  {alias: []collalias{{0b01000000, "utf8mb4_lv_0900_ai_ci"}}, isdefault: 0b00000000},
+	259:  {alias: []collalias{{0b01000000, "utf8mb4_ro_0900_ai_ci"}}, isdefault: 0b00000000},
+	260:  {alias: []collalias{{0b01000000, "utf8mb4_sl_0900_ai_ci"}}, isdefault: 0b00000000},
+	261:  {alias: []collalias{{0b01000000, "utf8mb4_pl_0900_ai_ci"}}, isdefault: 0b00000000},
+	262:  {alias: []collalias{{0b01000000, "utf8mb4_et_0900_ai_ci"}}, isdefault: 0b00000000},
+	263:  {alias: []collalias{{0b01000000, "utf8mb4_es_0900_ai_ci"}}, isdefault: 0b00000000},
+	264:  {alias: []collalias{{0b01000000, "utf8mb4_sv_0900_ai_ci"}}, isdefault: 0b00000000},
+	265:  {alias: []collalias{{0b01000000, "utf8mb4_tr_0900_ai_ci"}}, isdefault: 0b00000000},
+	266:  {alias: []collalias{{0b01000000, "utf8mb4_cs_0900_ai_ci"}}, isdefault: 0b00000000},
+	267:  {alias: []collalias{{0b01000000, "utf8mb4_da_0900_ai_ci"}}, isdefault: 0b00000000},
+	268:  {alias: []collalias{{0b01000000, "utf8mb4_lt_0900_ai_ci"}}, isdefault: 0b00000000},
+	269:  {alias: []collalias{{0b01000000, "utf8mb4_sk_0900_ai_ci"}}, isdefault: 0b00000000},
+	270:  {alias: []collalias{{0b01000000, "utf8mb4_es_trad_0900_ai_ci"}}, isdefault: 0b00000000},
+	271:  {alias: []collalias{{0b01000000, "utf8mb4_la_0900_ai_ci"}}, isdefault: 0b00000000},
+	273:  {alias: []collalias{{0b01000000, "utf8mb4_eo_0900_ai_ci"}}, isdefault: 0b00000000},
+	274:  {alias: []collalias{{0b01000000, "utf8mb4_hu_0900_ai_ci"}}, isdefault: 0b00000000},
+	275:  {alias: []collalias{{0b01000000, "utf8mb4_hr_0900_ai_ci"}}, isdefault: 0b00000000},
+	277:  {alias: []collalias{{0b01000000, "utf8mb4_vi_0900_ai_ci"}}, isdefault: 0b00000000},
+	278:  {alias: []collalias{{0b01000000, "utf8mb4_0900_as_cs"}}, isdefault: 0b00000000},
+	279:  {alias: []collalias{{0b01000000, "utf8mb4_de_pb_0900_as_cs"}}, isdefault: 0b00000000},
+	280:  {alias: []collalias{{0b01000000, "utf8mb4_is_0900_as_cs"}}, isdefault: 0b00000000},
+	281:  {alias: []collalias{{0b01000000, "utf8mb4_lv_0900_as_cs"}}, isdefault: 0b00000000},
+	282:  {alias: []collalias{{0b01000000, "utf8mb4_ro_0900_as_cs"}}, isdefault: 0b00000000},
+	283:  {alias: []collalias{{0b01000000, "utf8mb4_sl_0900_as_cs"}}, isdefault: 0b00000000},
+	284:  {alias: []collalias{{0b01000000, "utf8mb4_pl_0900_as_cs"}}, isdefault: 0b00000000},
+	285:  {alias: []collalias{{0b01000000, "utf8mb4_et_0900_as_cs"}}, isdefault: 0b00000000},
+	286:  {alias: []collalias{{0b01000000, "utf8mb4_es_0900_as_cs"}}, isdefault: 0b00000000},
+	287:  {alias: []collalias{{0b01000000, "utf8mb4_sv_0900_as_cs"}}, isdefault: 0b00000000},
+	288:  {alias: []collalias{{0b01000000, "utf8mb4_tr_0900_as_cs"}}, isdefault: 0b00000000},
+	289:  {alias: []collalias{{0b01000000, "utf8mb4_cs_0900_as_cs"}}, isdefault: 0b00000000},
+	290:  {alias: []collalias{{0b01000000, "utf8mb4_da_0900_as_cs"}}, isdefault: 0b00000000},
+	291:  {alias: []collalias{{0b01000000, "utf8mb4_lt_0900_as_cs"}}, isdefault: 0b00000000},
+	292:  {alias: []collalias{{0b01000000, "utf8mb4_sk_0900_as_cs"}}, isdefault: 0b00000000},
+	293:  {alias: []collalias{{0b01000000, "utf8mb4_es_trad_0900_as_cs"}}, isdefault: 0b00000000},
+	294:  {alias: []collalias{{0b01000000, "utf8mb4_la_0900_as_cs"}}, isdefault: 0b00000000},
+	296:  {alias: []collalias{{0b01000000, "utf8mb4_eo_0900_as_cs"}}, isdefault: 0b00000000},
+	297:  {alias: []collalias{{0b01000000, "utf8mb4_hu_0900_as_cs"}}, isdefault: 0b00000000},
+	298:  {alias: []collalias{{0b01000000, "utf8mb4_hr_0900_as_cs"}}, isdefault: 0b00000000},
+	300:  {alias: []collalias{{0b01000000, "utf8mb4_vi_0900_as_cs"}}, isdefault: 0b00000000},
+	303:  {alias: []collalias{{0b01000000, "utf8mb4_ja_0900_as_cs"}}, isdefault: 0b00000000},
+	304:  {alias: []collalias{{0b01000000, "utf8mb4_ja_0900_as_cs_ks"}}, isdefault: 0b00000000},
+	305:  {alias: []collalias{{0b01000000, "utf8mb4_0900_as_ci"}}, isdefault: 0b00000000},
+	306:  {alias: []collalias{{0b01000000, "utf8mb4_ru_0900_ai_ci"}}, isdefault: 0b00000000},
+	307:  {alias: []collalias{{0b01000000, "utf8mb4_ru_0900_as_cs"}}, isdefault: 0b00000000},
+	308:  {alias: []collalias{{0b01000000, "utf8mb4_zh_0900_as_cs"}}, isdefault: 0b00000000},
+	309:  {alias: []collalias{{0b01000000, "utf8mb4_0900_bin"}}, isdefault: 0b00000000},
+	576:  {alias: []collalias{{0b00001111, "utf8_croatian_ci"}, {0b00001111, "utf8mb3_croatian_ci"}}, isdefault: 0b00000000},
+	577:  {alias: []collalias{{0b00001111, "utf8_myanmar_ci"}, {0b00001111, "utf8mb3_myanmar_ci"}}, isdefault: 0b00000000},
+	578:  {alias: []collalias{{0b00001110, "utf8_thai_520_w2"}, {0b00001110, "utf8mb3_thai_520_w2"}}, isdefault: 0b00000000},
+	608:  {alias: []collalias{{0b00001111, "utf8mb4_croatian_ci"}}, isdefault: 0b00000000},
+	609:  {alias: []collalias{{0b00001111, "utf8mb4_myanmar_ci"}}, isdefault: 0b00000000},
+	610:  {alias: []collalias{{0b00001110, "utf8mb4_thai_520_w2"}}, isdefault: 0b00000000},
+	640:  {alias: []collalias{{0b00001111, "ucs2_croatian_ci"}}, isdefault: 0b00000000},
+	641:  {alias: []collalias{{0b00001111, "ucs2_myanmar_ci"}}, isdefault: 0b00000000},
+	642:  {alias: []collalias{{0b00001110, "ucs2_thai_520_w2"}}, isdefault: 0b00000000},
+	672:  {alias: []collalias{{0b00001111, "utf16_croatian_ci"}}, isdefault: 0b00000000},
+	673:  {alias: []collalias{{0b00001111, "utf16_myanmar_ci"}}, isdefault: 0b00000000},
+	674:  {alias: []collalias{{0b00001110, "utf16_thai_520_w2"}}, isdefault: 0b00000000},
+	736:  {alias: []collalias{{0b00001111, "utf32_croatian_ci"}}, isdefault: 0b00000000},
+	737:  {alias: []collalias{{0b00001111, "utf32_myanmar_ci"}}, isdefault: 0b00000000},
+	738:  {alias: []collalias{{0b00001110, "utf32_thai_520_w2"}}, isdefault: 0b00000000},
+	1025: {alias: []collalias{{0b00001100, "big5_chinese_nopad_ci"}}, isdefault: 0b00000000},
+	1027: {alias: []collalias{{0b00001100, "dec8_swedish_nopad_ci"}}, isdefault: 0b00000000},
+	1028: {alias: []collalias{{0b00001100, "cp850_general_nopad_ci"}}, isdefault: 0b00000000},
+	1030: {alias: []collalias{{0b00001100, "hp8_english_nopad_ci"}}, isdefault: 0b00000000},
+	1031: {alias: []collalias{{0b00001100, "koi8r_general_nopad_ci"}}, isdefault: 0b00000000},
+	1032: {alias: []collalias{{0b00001100, "latin1_swedish_nopad_ci"}}, isdefault: 0b00000000},
+	1033: {alias: []collalias{{0b00001100, "latin2_general_nopad_ci"}}, isdefault: 0b00000000},
+	1034: {alias: []collalias{{0b00001100, "swe7_swedish_nopad_ci"}}, isdefault: 0b00000000},
+	1035: {alias: []collalias{{0b00001100, "ascii_general_nopad_ci"}}, isdefault: 0b00000000},
+	1036: {alias: []collalias{{0b00001100, "ujis_japanese_nopad_ci"}}, isdefault: 0b00000000},
+	1037: {alias: []collalias{{0b00001100, "sjis_japanese_nopad_ci"}}, isdefault: 0b00000000},
+	1040: {alias: []collalias{{0b00001100, "hebrew_general_nopad_ci"}}, isdefault: 0b00000000},
+	1042: {alias: []collalias{{0b00001100, "tis620_thai_nopad_ci"}}, isdefault: 0b00000000},
+	1043: {alias: []collalias{{0b00001100, "euckr_korean_nopad_ci"}}, isdefault: 0b00000000},
+	1046: {alias: []collalias{{0b00001100, "koi8u_general_nopad_ci"}}, isdefault: 0b00000000},
+	1048: {alias: []collalias{{0b00001100, "gb2312_chinese_nopad_ci"}}, isdefault: 0b00000000},
+	1049: {alias: []collalias{{0b00001100, "greek_general_nopad_ci"}}, isdefault: 0b00000000},
+	1050: {alias: []collalias{{0b00001100, "cp1250_general_nopad_ci"}}, isdefault: 0b00000000},
+	1052: {alias: []collalias{{0b00001100, "gbk_chinese_nopad_ci"}}, isdefault: 0b00000000},
+	1054: {alias: []collalias{{0b00001100, "latin5_turkish_nopad_ci"}}, isdefault: 0b00000000},
+	1056: {alias: []collalias{{0b00001100, "armscii8_general_nopad_ci"}}, isdefault: 0b00000000},
+	1057: {alias: []collalias{{0b00001100, "utf8_general_nopad_ci"}, {0b00001100, "utf8mb3_general_nopad_ci"}}, isdefault: 0b00000000},
+	1059: {alias: []collalias{{0b00001100, "ucs2_general_nopad_ci"}}, isdefault: 0b00000000},
+	1060: {alias: []collalias{{0b00001100, "cp866_general_nopad_ci"}}, isdefault: 0b00000000},
+	1061: {alias: []collalias{{0b00001100, "keybcs2_general_nopad_ci"}}, isdefault: 0b00000000},
+	1062: {alias: []collalias{{0b00001100, "macce_general_nopad_ci"}}, isdefault: 0b00000000},
+	1063: {alias: []collalias{{0b00001100, "macroman_general_nopad_ci"}}, isdefault: 0b00000000},
+	1064: {alias: []collalias{{0b00001100, "cp852_general_nopad_ci"}}, isdefault: 0b00000000},
+	1065: {alias: []collalias{{0b00001100, "latin7_general_nopad_ci"}}, isdefault: 0b00000000},
+	1067: {alias: []collalias{{0b00001100, "macce_nopad_bin"}}, isdefault: 0b00000000},
+	1069: {alias: []collalias{{0b00001100, "utf8mb4_general_nopad_ci"}}, isdefault: 0b00000000},
+	1070: {alias: []collalias{{0b00001100, "utf8mb4_nopad_bin"}}, isdefault: 0b00000000},
+	1071: {alias: []collalias{{0b00001100, "latin1_nopad_bin"}}, isdefault: 0b00000000},
+	1074: {alias: []collalias{{0b00001100, "cp1251_nopad_bin"}}, isdefault: 0b00000000},
+	1075: {alias: []collalias{{0b00001100, "cp1251_general_nopad_ci"}}, isdefault: 0b00000000},
+	1077: {alias: []collalias{{0b00001100, "macroman_nopad_bin"}}, isdefault: 0b00000000},
+	1078: {alias: []collalias{{0b00001100, "utf16_general_nopad_ci"}}, isdefault: 0b00000000},
+	1079: {alias: []collalias{{0b00001100, "utf16_nopad_bin"}}, isdefault: 0b00000000},
+	1080: {alias: []collalias{{0b00001100, "utf16le_general_nopad_ci"}}, isdefault: 0b00000000},
+	1081: {alias: []collalias{{0b00001100, "cp1256_general_nopad_ci"}}, isdefault: 0b00000000},
+	1082: {alias: []collalias{{0b00001100, "cp1257_nopad_bin"}}, isdefault: 0b00000000},
+	1083: {alias: []collalias{{0b00001100, "cp1257_general_nopad_ci"}}, isdefault: 0b00000000},
+	1084: {alias: []collalias{{0b00001100, "utf32_general_nopad_ci"}}, isdefault: 0b00000000},
+	1085: {alias: []collalias{{0b00001100, "utf32_nopad_bin"}}, isdefault: 0b00000000},
+	1086: {alias: []collalias{{0b00001100, "utf16le_nopad_bin"}}, isdefault: 0b00000000},
+	1088: {alias: []collalias{{0b00001100, "armscii8_nopad_bin"}}, isdefault: 0b00000000},
+	1089: {alias: []collalias{{0b00001100, "ascii_nopad_bin"}}, isdefault: 0b00000000},
+	1090: {alias: []collalias{{0b00001100, "cp1250_nopad_bin"}}, isdefault: 0b00000000},
+	1091: {alias: []collalias{{0b00001100, "cp1256_nopad_bin"}}, isdefault: 0b00000000},
+	1092: {alias: []collalias{{0b00001100, "cp866_nopad_bin"}}, isdefault: 0b00000000},
+	1093: {alias: []collalias{{0b00001100, "dec8_nopad_bin"}}, isdefault: 0b00000000},
+	1094: {alias: []collalias{{0b00001100, "greek_nopad_bin"}}, isdefault: 0b00000000},
+	1095: {alias: []collalias{{0b00001100, "hebrew_nopad_bin"}}, isdefault: 0b00000000},
+	1096: {alias: []collalias{{0b00001100, "hp8_nopad_bin"}}, isdefault: 0b00000000},
+	1097: {alias: []collalias{{0b00001100, "keybcs2_nopad_bin"}}, isdefault: 0b00000000},
+	1098: {alias: []collalias{{0b00001100, "koi8r_nopad_bin"}}, isdefault: 0b00000000},
+	1099: {alias: []collalias{{0b00001100, "koi8u_nopad_bin"}}, isdefault: 0b00000000},
+	1101: {alias: []collalias{{0b00001100, "latin2_nopad_bin"}}, isdefault: 0b00000000},
+	1102: {alias: []collalias{{0b00001100, "latin5_nopad_bin"}}, isdefault: 0b00000000},
+	1103: {alias: []collalias{{0b00001100, "latin7_nopad_bin"}}, isdefault: 0b00000000},
+	1104: {alias: []collalias{{0b00001100, "cp850_nopad_bin"}}, isdefault: 0b00000000},
+	1105: {alias: []collalias{{0b00001100, "cp852_nopad_bin"}}, isdefault: 0b00000000},
+	1106: {alias: []collalias{{0b00001100, "swe7_nopad_bin"}}, isdefault: 0b00000000},
+	1107: {alias: []collalias{{0b00001100, "utf8_nopad_bin"}, {0b00001100, "utf8mb3_nopad_bin"}}, isdefault: 0b00000000},
+	1108: {alias: []collalias{{0b00001100, "big5_nopad_bin"}}, isdefault: 0b00000000},
+	1109: {alias: []collalias{{0b00001100, "euckr_nopad_bin"}}, isdefault: 0b00000000},
+	1110: {alias: []collalias{{0b00001100, "gb2312_nopad_bin"}}, isdefault: 0b00000000},
+	1111: {alias: []collalias{{0b00001100, "gbk_nopad_bin"}}, isdefault: 0b00000000},
+	1112: {alias: []collalias{{0b00001100, "sjis_nopad_bin"}}, isdefault: 0b00000000},
+	1113: {alias: []collalias{{0b00001100, "tis620_nopad_bin"}}, isdefault: 0b00000000},
+	1114: {alias: []collalias{{0b00001100, "ucs2_nopad_bin"}}, isdefault: 0b00000000},
+	1115: {alias: []collalias{{0b00001100, "ujis_nopad_bin"}}, isdefault: 0b00000000},
+	1116: {alias: []collalias{{0b00001100, "geostd8_general_nopad_ci"}}, isdefault: 0b00000000},
+	1117: {alias: []collalias{{0b00001100, "geostd8_nopad_bin"}}, isdefault: 0b00000000},
+	1119: {alias: []collalias{{0b00001100, "cp932_japanese_nopad_ci"}}, isdefault: 0b00000000},
+	1120: {alias: []collalias{{0b00001100, "cp932_nopad_bin"}}, isdefault: 0b00000000},
+	1121: {alias: []collalias{{0b00001100, "eucjpms_japanese_nopad_ci"}}, isdefault: 0b00000000},
+	1122: {alias: []collalias{{0b00001100, "eucjpms_nopad_bin"}}, isdefault: 0b00000000},
+	1125: {alias: []collalias{{0b00001100, "utf16_unicode_nopad_ci"}}, isdefault: 0b00000000},
+	1147: {alias: []collalias{{0b00001100, "utf16_unicode_520_nopad_ci"}}, isdefault: 0b00000000},
+	1152: {alias: []collalias{{0b00001100, "ucs2_unicode_nopad_ci"}}, isdefault: 0b00000000},
+	1174: {alias: []collalias{{0b00001100, "ucs2_unicode_520_nopad_ci"}}, isdefault: 0b00000000},
+	1184: {alias: []collalias{{0b00001100, "utf32_unicode_nopad_ci"}}, isdefault: 0b00000000},
+	1206: {alias: []collalias{{0b00001100, "utf32_unicode_520_nopad_ci"}}, isdefault: 0b00000000},
+	1216: {alias: []collalias{{0b00001100, "utf8_unicode_nopad_ci"}, {0b00001100, "utf8mb3_unicode_nopad_ci"}}, isdefault: 0b00000000},
+	1238: {alias: []collalias{{0b00001100, "utf8_unicode_520_nopad_ci"}, {0b00001100, "utf8mb3_unicode_520_nopad_ci"}}, isdefault: 0b00000000},
+	1248: {alias: []collalias{{0b00001100, "utf8mb4_unicode_nopad_ci"}}, isdefault: 0b00000000},
+	1270: {alias: []collalias{{0b00001100, "utf8mb4_unicode_520_nopad_ci"}}, isdefault: 0b00000000},
 }
diff --git a/go/mysql/collations/tools/makecolldata/main.go b/go/mysql/collations/tools/makecolldata/main.go
index 93caacd0ff..212fc5d73a 100644
--- a/go/mysql/collations/tools/makecolldata/main.go
+++ b/go/mysql/collations/tools/makecolldata/main.go
@@ -82,6 +82,10 @@ func loadMysqlMetadata() (all AllMetadata) {
 		}
 		_ = rf.Close()
 
+		if _, aliased := CharsetAliases[meta.Charset]; aliased {
+			meta.Charset = CharsetAliases[meta.Charset]
+		}
+
 		all = append(all, &meta)
 	}
 
diff --git a/go/mysql/collations/tools/makecolldata/mysqlversions.go b/go/mysql/collations/tools/makecolldata/mysqlversions.go
index d3e509e1ec..7bd61862d6 100644
--- a/go/mysql/collations/tools/makecolldata/mysqlversions.go
+++ b/go/mysql/collations/tools/makecolldata/mysqlversions.go
@@ -43,6 +43,13 @@ type alias struct {
 	name string
 }
 
+// CharsetAliases is a list of all aliases that MySQL uses to refer to charsets.
+// As of MySQL 8, all versions of MySQL map the utf8 charset to utf8mb3;
+// this will be changed sometime in the future so it maps to utf8mb4.
+var CharsetAliases = map[string]string{
+	"utf8": "utf8mb3",
+}
+
 func makeversions(output string) {
 	flag.Parse()
 
@@ -79,7 +86,16 @@ func makeversions(output string) {
 				versioninfo[uint(collid)] = vi
 			}
 
-			vi.alias[cols[0]] |= 1 << v
+			collname := cols[0]
+			vi.alias[collname] |= 1 << v
+
+			for from, to := range CharsetAliases {
+				if strings.HasPrefix(collname, from+"_") {
+					aliased := strings.Replace(collname, from+"_", to+"_", 1)
+					vi.alias[aliased] |= 1 << v
+				}
+			}
+
 			switch cols[3] {
 			case "Yes":
 				vi.isdefault |= 1 << v
@@ -102,6 +118,7 @@ func makeversions(output string) {
 
 	var g = codegen.NewGenerator("vitess.io/vitess/go/mysql/collations")
 	g.P("type collver byte")
+	g.P("type collalias struct { mask collver; name string }")
 	g.P("const (")
 	g.P("collverInvalid collver = 0")
 	for n, version := range versions {
@@ -123,8 +140,14 @@ func makeversions(output string) {
 	g.P("default: panic(\"invalid version identifier\")")
 	g.P("}")
 	g.P("}")
+
+	// These are the default aliases for charsets; right now they're common between
+	// all MySQL versions, but this is implemented as a method on `collver` so when
+	// MySQL maps utf8 to utfmb4, we can perform the mapping only for the specific
+	// MySQL version onwards.
+	g.P("func (v collver) charsetAliases() map[string]string { return ", fmt.Sprintf("%#v", CharsetAliases), "}")
 	g.P()
-	g.P("var globalVersionInfo = map[ID]struct{alias map[collver]string; isdefault collver}{")
+	g.P("var globalVersionInfo = map[ID]struct{alias []collalias; isdefault collver}{")
 
 	var sorted []*versionInfo
 	for _, vi := range versioninfo {
@@ -141,9 +164,9 @@ func makeversions(output string) {
 		sort.Slice(reverse, func(i, j int) bool {
 			return reverse[i].name < reverse[j].name
 		})
-		fmt.Fprintf(g, "%d: {alias: map[collver]string{", vi.id)
+		fmt.Fprintf(g, "%d: {alias: []collalias{", vi.id)
 		for _, a := range reverse {
-			fmt.Fprintf(g, "0b%08b: %q,", a.mask, a.name)
+			fmt.Fprintf(g, "{0b%08b, %q},", a.mask, a.name)
 		}
 		fmt.Fprintf(g, "}, isdefault: 0b%08b},\n", vi.isdefault)
 	}
diff --git a/go/vt/schemadiff/mysql.go b/go/vt/schemadiff/mysql.go
index 74c6a11622..768714af7a 100644
--- a/go/vt/schemadiff/mysql.go
+++ b/go/vt/schemadiff/mysql.go
@@ -21,10 +21,6 @@ var engineCasing = map[string]string{
 	"MYISAM": "MyISAM",
 }
 
-var charsetAliases = map[string]string{
-	"utf8": "utf8mb3",
-}
-
 var integralTypes = map[string]bool{
 	"tinyint":   true,
 	"smallint":  true,
diff --git a/go/vt/schemadiff/table.go b/go/vt/schemadiff/table.go
index 7b30d3d1e1..d1206b7b7c 100644
--- a/go/vt/schemadiff/table.go
+++ b/go/vt/schemadiff/table.go
@@ -252,7 +252,7 @@ func (c *CreateTableEntity) normalizeTableOptions() {
 		switch strings.ToUpper(opt.Name) {
 		case "CHARSET", "COLLATE":
 			opt.String = strings.ToLower(opt.String)
-			if charset, ok := charsetAliases[opt.String]; ok {
+			if charset, ok := collationEnv.CharsetAlias(opt.String); ok {
 				opt.String = charset
 			}
 		case "ENGINE":
@@ -280,12 +280,6 @@ func defaultCharset() string {
 }
 
 func defaultCharsetCollation(charset string) string {
-	// The collation tables are based on utf8, not the utf8mb3 alias.
-	// We already normalize to utf8mb3 to be explicit, so we have to
-	// map it back here to find the default collation for utf8mb3.
-	if charset == "utf8mb3" {
-		charset = "utf8"
-	}
 	collation := collationEnv.DefaultCollationForCharset(charset)
 	if collation == nil {
 		return ""
@@ -348,7 +342,7 @@ func (c *CreateTableEntity) normalizeColumnOptions() {
 
 		// Map any charset aliases to the real charset. This applies mainly right
 		// now to utf8 being an alias for utf8mb3.
-		if charset, ok := charsetAliases[col.Type.Charset]; ok {
+		if charset, ok := collationEnv.CharsetAlias(col.Type.Charset); ok {
 			col.Type.Charset = charset
 		}
 
diff --git a/go/vt/vtgate/engine/ordered_aggregate.go b/go/vt/vtgate/engine/ordered_aggregate.go
index d532dc9fb5..dc159a4970 100644
--- a/go/vt/vtgate/engine/ordered_aggregate.go
+++ b/go/vt/vtgate/engine/ordered_aggregate.go
@@ -102,8 +102,9 @@ type AggregateParams struct {
 	WAssigned   bool
 	CollationID collations.ID
 
-	Alias string `json:",omitempty"`
-	Expr  sqlparser.Expr
+	Alias    string `json:",omitempty"`
+	Expr     sqlparser.Expr
+	Original *sqlparser.AliasedExpr
 }
 
 func (ap *AggregateParams) isDistinct() bool {
@@ -141,6 +142,7 @@ const (
 	AggregateCountDistinct
 	AggregateSumDistinct
 	AggregateGtid
+	AggregateRandom
 )
 
 var (
@@ -178,7 +180,7 @@ func (code AggregateOpcode) String() string {
 			return k
 		}
 	}
-	panic("unreachable")
+	return "random"
 }
 
 // MarshalJSON serializes the AggregateOpcode as a JSON string.
@@ -476,6 +478,8 @@ func merge(
 			data, _ := proto.Marshal(vgtid)
 			val, _ := sqltypes.NewValue(sqltypes.VarBinary, data)
 			result[aggr.Col] = val
+		case AggregateRandom:
+			// we just grab the first value per grouping. no need to do anything more complicated here
 		default:
 			return nil, nil, fmt.Errorf("BUG: Unexpected opcode: %v", aggr.Opcode)
 		}
diff --git a/go/vt/vtgate/planbuilder/abstract/queryprojection.go b/go/vt/vtgate/planbuilder/abstract/queryprojection.go
index b80d23c744..f91c3ae576 100644
--- a/go/vt/vtgate/planbuilder/abstract/queryprojection.go
+++ b/go/vt/vtgate/planbuilder/abstract/queryprojection.go
@@ -26,7 +26,6 @@ import (
 	vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
 	"vitess.io/vitess/go/vt/sqlparser"
 	"vitess.io/vitess/go/vt/vterrors"
-	"vitess.io/vitess/go/vt/vtgate/semantics"
 )
 
 type (
@@ -46,7 +45,6 @@ type (
 		OrderExprs         []OrderBy
 		CanPushDownSorting bool
 		HasStar            bool
-		ProjectionError    error
 	}
 
 	// OrderBy contains the expression to used in order by and also if ordering is needed at VTGate level then what the weight_string function expression to be sent down for evaluation.
@@ -66,6 +64,16 @@ type (
 		// The original aliased expression that this group by is referring
 		aliasedExpr *sqlparser.AliasedExpr
 	}
+
+	Aggr struct {
+		Original *sqlparser.AliasedExpr
+		Func     *sqlparser.FuncExpr
+		OpCode   engine.AggregateOpcode
+		Alias    string
+		// The index at which the user expects to see this aggregated function. Set to nil, if the user does not ask for it
+		Index    *int
+		Distinct bool
+	}
 )
 
 func (b GroupBy) AsOrderBy() OrderBy {
@@ -122,7 +130,7 @@ func (s SelectExpr) GetAliasedExpr() (*sqlparser.AliasedExpr, error) {
 }
 
 // CreateQPFromSelect creates the QueryProjection for the input *sqlparser.Select
-func CreateQPFromSelect(sel *sqlparser.Select, semTable *semantics.SemTable) (*QueryProjection, error) {
+func CreateQPFromSelect(sel *sqlparser.Select) (*QueryProjection, error) {
 	qp := &QueryProjection{
 		Distinct: sel.Distinct,
 	}
@@ -133,7 +141,7 @@ func CreateQPFromSelect(sel *sqlparser.Select, semTable *semantics.SemTable) (*Q
 	}
 	for _, group := range sel.GroupBy {
 		selectExprIdx, aliasExpr := qp.FindSelectExprIndexForExpr(group)
-		expr, weightStrExpr, err := qp.GetSimplifiedExpr(group, semTable)
+		expr, weightStrExpr, err := qp.GetSimplifiedExpr(group)
 		if err != nil {
 			return nil, err
 		}
@@ -152,23 +160,11 @@ func CreateQPFromSelect(sel *sqlparser.Select, semTable *semantics.SemTable) (*Q
 		qp.groupByExprs = append(qp.groupByExprs, groupBy)
 	}
 
-	err = qp.addOrderBy(sel.OrderBy, semTable)
+	err = qp.addOrderBy(sel.OrderBy)
 	if err != nil {
 		return nil, err
 	}
 
-	if qp.HasAggr || len(qp.groupByExprs) > 0 {
-		expr := qp.getNonAggrExprNotMatchingGroupByExprs()
-		// if we have aggregation functions, non aggregating columns and GROUP BY,
-		// the non-aggregating expressions must all be listed in the GROUP BY list
-		if expr != nil {
-			if len(qp.groupByExprs) == 0 {
-				return nil, vterrors.NewErrorf(vtrpcpb.Code_INVALID_ARGUMENT, vterrors.MixOfGroupFuncAndFields, "In aggregated query without GROUP BY, expression of SELECT list contains nonaggregated column '%s'; this is incompatible with sql_mode=only_full_group_by", sqlparser.String(expr))
-			}
-			qp.ProjectionError = vterrors.NewErrorf(vtrpcpb.Code_INVALID_ARGUMENT, vterrors.WrongFieldWithGroup, "Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column '%s' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by", sqlparser.String(expr))
-		}
-	}
-
 	if qp.Distinct && !qp.HasAggr {
 		qp.groupByExprs = nil
 	}
@@ -207,7 +203,7 @@ func (qp *QueryProjection) addSelectExpressions(sel *sqlparser.Select) error {
 }
 
 // CreateQPFromUnion creates the QueryProjection for the input *sqlparser.Union
-func CreateQPFromUnion(union *sqlparser.Union, semTable *semantics.SemTable) (*QueryProjection, error) {
+func CreateQPFromUnion(union *sqlparser.Union) (*QueryProjection, error) {
 	qp := &QueryProjection{}
 
 	sel := sqlparser.GetFirstSelect(union)
@@ -216,7 +212,7 @@ func CreateQPFromUnion(union *sqlparser.Union, semTable *semantics.SemTable) (*Q
 		return nil, err
 	}
 
-	err = qp.addOrderBy(union.OrderBy, semTable)
+	err = qp.addOrderBy(union.OrderBy)
 	if err != nil {
 		return nil, err
 	}
@@ -224,10 +220,10 @@ func CreateQPFromUnion(union *sqlparser.Union, semTable *semantics.SemTable) (*Q
 	return qp, nil
 }
 
-func (qp *QueryProjection) addOrderBy(orderBy sqlparser.OrderBy, semTable *semantics.SemTable) error {
+func (qp *QueryProjection) addOrderBy(orderBy sqlparser.OrderBy) error {
 	canPushDownSorting := true
 	for _, order := range orderBy {
-		expr, weightStrExpr, err := qp.GetSimplifiedExpr(order.Expr, semTable)
+		expr, weightStrExpr, err := qp.GetSimplifiedExpr(order.Expr)
 		if err != nil {
 			return err
 		}
@@ -272,34 +268,12 @@ func (qp *QueryProjection) getNonAggrExprNotMatchingGroupByExprs() sqlparser.Sel
 		if expr.Aggr {
 			continue
 		}
-		isGroupByOk := false
-		for _, groupByExpr := range qp.groupByExprs {
-			exp, err := expr.GetExpr()
-			if err != nil {
-				return expr.Col
-			}
-			if sqlparser.EqualsExpr(groupByExpr.WeightStrExpr, exp) {
-				isGroupByOk = true
-				break
-			}
-		}
-		if !isGroupByOk {
+		if !qp.isExprInGroupByExprs(expr) {
 			return expr.Col
 		}
 	}
 	for _, order := range qp.OrderExprs {
-		// ORDER BY NULL or Aggregation functions need not be present in group by
-		if sqlparser.IsNull(order.Inner.Expr) || sqlparser.IsAggregation(order.WeightStrExpr) {
-			continue
-		}
-		isGroupByOk := false
-		for _, groupByExpr := range qp.groupByExprs {
-			if sqlparser.EqualsExpr(groupByExpr.WeightStrExpr, order.WeightStrExpr) {
-				isGroupByOk = true
-				break
-			}
-		}
-		if !isGroupByOk {
+		if !qp.isOrderByExprInGroupBy(order) {
 			return &sqlparser.AliasedExpr{
 				Expr: order.Inner.Expr,
 			}
@@ -308,11 +282,34 @@ func (qp *QueryProjection) getNonAggrExprNotMatchingGroupByExprs() sqlparser.Sel
 	return nil
 }
 
+func (qp *QueryProjection) isOrderByExprInGroupBy(order OrderBy) bool {
+	// ORDER BY NULL or Aggregation functions need not be present in group by
+	if sqlparser.IsNull(order.Inner.Expr) || sqlparser.IsAggregation(order.WeightStrExpr) {
+		return true
+	}
+	for _, groupByExpr := range qp.groupByExprs {
+		if sqlparser.EqualsExpr(groupByExpr.WeightStrExpr, order.WeightStrExpr) {
+			return true
+		}
+	}
+	return false
+}
+
+func (qp *QueryProjection) isExprInGroupByExprs(expr SelectExpr) bool {
+	for _, groupByExpr := range qp.groupByExprs {
+		exp, err := expr.GetExpr()
+		if err != nil {
+			return false
+		}
+		if sqlparser.EqualsExpr(groupByExpr.WeightStrExpr, exp) {
+			return true
+		}
+	}
+	return false
+}
+
 // GetSimplifiedExpr takes an expression used in ORDER BY or GROUP BY, and returns an expression that is simpler to evaluate
-func (qp *QueryProjection) GetSimplifiedExpr(
-	e sqlparser.Expr,
-	semTable *semantics.SemTable,
-) (expr sqlparser.Expr, weightStrExpr sqlparser.Expr, err error) {
+func (qp *QueryProjection) GetSimplifiedExpr(e sqlparser.Expr) (expr sqlparser.Expr, weightStrExpr sqlparser.Expr, err error) {
 	// If the ORDER BY is against a column alias, we need to remember the expression
 	// behind the alias. The weightstring(.) calls needs to be done against that expression and not the alias.
 	// Eg - select music.foo as bar, weightstring(music.foo) from music order by bar
@@ -405,25 +402,27 @@ func (qp *QueryProjection) NeedsDistinct() bool {
 	return true
 }
 
-type Aggr struct {
-	Original *sqlparser.AliasedExpr
-	Func     *sqlparser.FuncExpr
-	OpCode   engine.AggregateOpcode
-	Alias    string
-	// The index at which the user expects to see this aggregated function. Set to nil, if the user does not ask for it
-	Index    *int
-	Distinct bool
-}
-
 func (qp *QueryProjection) AggregationExpressions() (out []Aggr, err error) {
 	for idx, expr := range qp.SelectExprs {
-		if !sqlparser.ContainsAggregation(expr.Col) {
-			continue
-		}
 		aliasedExpr, err := expr.GetAliasedExpr()
 		if err != nil {
 			return nil, err
 		}
+
+		idxCopy := idx
+
+		if !sqlparser.ContainsAggregation(expr.Col) {
+			if !qp.isExprInGroupByExprs(expr) {
+				out = append(out, Aggr{
+					Original: aliasedExpr,
+					OpCode:   engine.AggregateRandom,
+					Alias:    aliasedExpr.ColumnName(),
+					Index:    &idxCopy,
+				})
+			}
+			continue
+		}
+
 		fExpr, isFunc := aliasedExpr.Expr.(*sqlparser.FuncExpr)
 		if !isFunc {
 			return nil, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: in scatter query: complex aggregate expression")
@@ -444,7 +443,6 @@ func (qp *QueryProjection) AggregationExpressions() (out []Aggr, err error) {
 			}
 		}
 
-		idxCopy := idx
 		out = append(out, Aggr{
 			Original: aliasedExpr,
 			Func:     fExpr,
@@ -454,6 +452,28 @@ func (qp *QueryProjection) AggregationExpressions() (out []Aggr, err error) {
 			Distinct: fExpr.Distinct,
 		})
 	}
+	for i, orderExpr := range qp.OrderExprs {
+		newIdx := i + len(qp.SelectExprs)
+		if !qp.isOrderByExprInGroupBy(orderExpr) {
+
+			original := &sqlparser.AliasedExpr{Expr: orderExpr.Inner.Expr}
+			found := false
+			for _, aggr := range out {
+				if sqlparser.EqualsRefOfAliasedExpr(aggr.Original, original) {
+					found = true
+					break
+				}
+			}
+			if found {
+				continue
+			}
+			out = append(out, Aggr{
+				Original: original,
+				OpCode:   engine.AggregateRandom,
+				Index:    &newIdx,
+			})
+		}
+	}
 	return
 }
 
diff --git a/go/vt/vtgate/planbuilder/aggregation_pushing.go b/go/vt/vtgate/planbuilder/aggregation_pushing.go
index 4707c667b6..bae6486f2b 100644
--- a/go/vt/vtgate/planbuilder/aggregation_pushing.go
+++ b/go/vt/vtgate/planbuilder/aggregation_pushing.go
@@ -38,7 +38,7 @@ func (hp *horizonPlanning) pushAggregation(
 	switch plan := plan.(type) {
 	case *routeGen4:
 		output = plan
-		groupingOffsets, outputAggrsOffset, err = pushAggrOnRoute(ctx, plan, aggregations, grouping, ignoreOutputOrder)
+		groupingOffsets, outputAggrsOffset, _, err = pushAggrOnRoute(ctx, plan, aggregations, grouping, ignoreOutputOrder)
 		return
 
 	case *joinGen4:
@@ -67,14 +67,18 @@ func pushAggrOnRoute(
 	aggregations []abstract.Aggr,
 	grouping []abstract.GroupBy,
 	ignoreOutputOrder bool,
-) ([]offsets, [][]offsets, error) {
+) (
+	groupingOffsets []offsets,
+	vtgateAggregation [][]offsets,
+	nonAggrOffsets []offsets,
+	err error,
+) {
 	columnOrderMatters := !ignoreOutputOrder
 	sel, isSel := plan.Select.(*sqlparser.Select)
 	if !isSel {
-		return nil, nil, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "can't plan aggregation on union")
+		return nil, nil, nil, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "can't plan aggregation on union")
 	}
 
-	var vtgateAggregation [][]offsets
 	var groupingCols []int
 	var reorg = passThrough
 
@@ -88,7 +92,7 @@ func pushAggrOnRoute(
 		grouping, reorg, it = sortOffsets(grouping, aggregations)
 		vtgateAggregation, groupingCols, err = pushAggrsAndGroupingInOrder(ctx, plan, it, sel, vtgateAggregation, groupingCols)
 		if err != nil {
-			return nil, nil, err
+			return nil, nil, nil, err
 		}
 	} else {
 		// if we haven't already pushed the aggregations, now is the time
@@ -98,7 +102,7 @@ func pushAggrOnRoute(
 		}
 	}
 
-	groupingOffsets := make([]offsets, 0, len(grouping))
+	groupingOffsets = make([]offsets, 0, len(grouping))
 	for idx, expr := range grouping {
 		sel.AddGroupBy(expr.Inner)
 		var pos offsets
@@ -106,7 +110,7 @@ func pushAggrOnRoute(
 			// we have not yet pushed anything, so we need to push the expression first
 			col, _, err := addExpressionToRoute(ctx, plan, &sqlparser.AliasedExpr{Expr: expr.Inner}, true)
 			if err != nil {
-				return nil, nil, err
+				return nil, nil, nil, err
 			}
 			pos = newOffset(col)
 		} else {
@@ -117,7 +121,7 @@ func pushAggrOnRoute(
 			wsExpr := weightStringFor(expr.WeightStrExpr)
 			wsCol, _, err := addExpressionToRoute(ctx, plan, &sqlparser.AliasedExpr{Expr: wsExpr}, true)
 			if err != nil {
-				return nil, nil, err
+				return nil, nil, nil, err
 			}
 			pos.wsCol = wsCol
 			sel.AddGroupBy(wsExpr)
@@ -126,7 +130,7 @@ func pushAggrOnRoute(
 	}
 
 	groupingOffsets, vtgateAggregation = reorg(groupingOffsets, vtgateAggregation)
-	return groupingOffsets, vtgateAggregation, nil
+	return groupingOffsets, vtgateAggregation, nil, nil
 }
 
 func pushAggrsAndGroupingInOrder(
@@ -214,7 +218,7 @@ func (hp *horizonPlanning) pushAggrOnJoin(
 
 	// We need to group by the columns used in the join condition.
 	// If we don't, the LHS will not be able to return the column, and it can't be used to send down to the RHS
-	lhsCols, err := hp.createGroupingsForColumns(ctx, join.LHSColumns)
+	lhsCols, err := hp.createGroupingsForColumns(join.LHSColumns)
 	if err != nil {
 		return nil, nil, err
 	}
@@ -298,7 +302,7 @@ func (hp *horizonPlanning) pushAggrOnSemiJoin(
 ) ([]offsets, [][]offsets, error) {
 	// We need to group by the columns used in the join condition.
 	// If we don't, the LHS will not be able to return the column, and it can't be used to send down to the RHS
-	lhsCols, err := hp.createGroupingsForColumns(ctx, join.LHSColumns)
+	lhsCols, err := hp.createGroupingsForColumns(join.LHSColumns)
 	if err != nil {
 		return nil, nil, err
 	}
diff --git a/go/vt/vtgate/planbuilder/gen4_planner.go b/go/vt/vtgate/planbuilder/gen4_planner.go
index 11445ddc27..996248046d 100644
--- a/go/vt/vtgate/planbuilder/gen4_planner.go
+++ b/go/vt/vtgate/planbuilder/gen4_planner.go
@@ -413,7 +413,7 @@ func planHorizon(ctx *plancontext.PlanningContext, plan logicalPlan, in sqlparse
 }
 
 func planOrderByOnUnion(ctx *plancontext.PlanningContext, plan logicalPlan, union *sqlparser.Union) (logicalPlan, error) {
-	qp, err := abstract.CreateQPFromUnion(union, ctx.SemTable)
+	qp, err := abstract.CreateQPFromUnion(union)
 	if err != nil {
 		return nil, err
 	}
diff --git a/go/vt/vtgate/planbuilder/horizon_planning.go b/go/vt/vtgate/planbuilder/horizon_planning.go
index 0033360542..4f45a15ec6 100644
--- a/go/vt/vtgate/planbuilder/horizon_planning.go
+++ b/go/vt/vtgate/planbuilder/horizon_planning.go
@@ -69,7 +69,7 @@ func (hp *horizonPlanning) planHorizon(ctx *plancontext.PlanningContext, plan lo
 	}
 
 	var err error
-	hp.qp, err = abstract.CreateQPFromSelect(hp.sel, ctx.SemTable)
+	hp.qp, err = abstract.CreateQPFromSelect(hp.sel)
 	if err != nil {
 		return nil, err
 	}
@@ -494,10 +494,6 @@ func (hp *horizonPlanning) planAggregations(ctx *plancontext.PlanningContext, pl
 		return newPlan, nil
 	}
 
-	if hp.qp.ProjectionError != nil {
-		return nil, hp.qp.ProjectionError
-	}
-
 	return hp.planAggrUsingOA(ctx, plan, grouping)
 }
 
@@ -652,15 +648,17 @@ func generateAggregateParams(aggrs []abstract.Aggr, aggrParamOffsets [][]offsets
 
 		opcode := engine.AggregateSum
 		if aggr.OpCode == engine.AggregateMin ||
-			aggr.OpCode == engine.AggregateMax {
+			aggr.OpCode == engine.AggregateMax ||
+			aggr.OpCode == engine.AggregateRandom {
 			opcode = aggr.OpCode
 		}
 
 		aggrParams[idx] = &engine.AggregateParams{
-			Opcode: opcode,
-			Col:    offset,
-			Alias:  aggr.Alias,
-			Expr:   aggr.Func,
+			Opcode:   opcode,
+			Col:      offset,
+			Alias:    aggr.Alias,
+			Expr:     aggr.Func,
+			Original: aggr.Original,
 		}
 	}
 	return aggrParams, nil
@@ -700,6 +698,7 @@ func addColumnsToOA(
 				WCol:        o.wsCol,
 				Alias:       a.Alias,
 				Expr:        a.Func,
+				Original:    a.Original,
 				CollationID: collID,
 			})
 		}
@@ -742,7 +741,7 @@ func (hp *horizonPlanning) handleDistinctAggr(ctx *plancontext.PlanningContext,
 			err = vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "syntax error: %s", sqlparser.String(expr.Original))
 			return
 		}
-		inner, innerWS, err := hp.qp.GetSimplifiedExpr(aliasedExpr.Expr, ctx.SemTable)
+		inner, innerWS, err := hp.qp.GetSimplifiedExpr(aliasedExpr.Expr)
 		if err != nil {
 			return nil, nil, nil, err
 		}
@@ -798,13 +797,10 @@ func newOffset(col int) offsets {
 	return offsets{col: col, wsCol: -1}
 }
 
-func (hp *horizonPlanning) createGroupingsForColumns(
-	ctx *plancontext.PlanningContext,
-	columns []*sqlparser.ColName,
-) ([]abstract.GroupBy, error) {
+func (hp *horizonPlanning) createGroupingsForColumns(columns []*sqlparser.ColName) ([]abstract.GroupBy, error) {
 	var lhsGrouping []abstract.GroupBy
 	for _, lhsColumn := range columns {
-		expr, wsExpr, err := hp.qp.GetSimplifiedExpr(lhsColumn, ctx.SemTable)
+		expr, wsExpr, err := hp.qp.GetSimplifiedExpr(lhsColumn)
 		if err != nil {
 			return nil, err
 		}
@@ -818,6 +814,9 @@ func (hp *horizonPlanning) createGroupingsForColumns(
 }
 
 func isCountStar(f *sqlparser.FuncExpr) bool {
+	if f == nil {
+		return false
+	}
 	_, isStar := f.Exprs[0].(*sqlparser.StarExpr)
 	return isStar
 }
@@ -1094,8 +1093,8 @@ func findExprInOrderedAggr(plan *orderedAggregate, order abstract.OrderBy) (keyC
 		}
 	}
 	for _, aggregate := range plan.aggregates {
-		if sqlparser.EqualsExpr(order.WeightStrExpr, aggregate.Expr) ||
-			sqlparser.EqualsExpr(order.Inner.Expr, aggregate.Expr) {
+		if sqlparser.EqualsExpr(order.WeightStrExpr, aggregate.Original.Expr) ||
+			sqlparser.EqualsExpr(order.Inner.Expr, aggregate.Original.Expr) {
 			return aggregate.Col, -1, true
 		}
 	}


Test patch:
diff --git a/go/mysql/collations/golden_test.go b/go/mysql/collations/golden_test.go
index f6323f1216..9d38e690da 100644
--- a/go/mysql/collations/golden_test.go
+++ b/go/mysql/collations/golden_test.go
@@ -124,18 +124,19 @@ func XTestSupportTables(t *testing.T) {
 		if coll == nil {
 			vdata := globalVersionInfo[id]
 
-			var collname string
-			for _, name := range vdata.alias {
-				collname = name
+			var collnames []string
+			for _, alias := range vdata.alias {
+				collnames = append(collnames, alias.name)
 				break
 			}
+			collname := strings.Join(collnames, ",")
 			parts := strings.Split(collname, "_")
 
 			fmt.Fprintf(out, "| %s | %s", collname, parts[0])
 			for _, env := range envs {
 				var supported bool
-				for v := range vdata.alias {
-					if v&env.version != 0 {
+				for _, alias := range vdata.alias {
+					if alias.mask&env.version != 0 {
 						supported = true
 						break
 					}
diff --git a/go/mysql/endtoend/query_test.go b/go/mysql/endtoend/query_test.go
index adcab4dbeb..1118c46f85 100644
--- a/go/mysql/endtoend/query_test.go
+++ b/go/mysql/endtoend/query_test.go
@@ -35,7 +35,7 @@ import (
 
 func columnSize(cs collations.ID, size uint32) uint32 {
 	// utf8_general_ci results in smaller max column sizes because MySQL 5.7 is silly
-	if collations.Local().LookupByID(cs).Charset().Name() == "utf8" {
+	if collations.Local().LookupByID(cs).Charset().Name() == "utf8mb3" {
 		return size * 3 / 4
 	}
 	return size
diff --git a/go/test/endtoend/vtgate/queries/aggregation/aggregation_test.go b/go/test/endtoend/vtgate/queries/aggregation/aggregation_test.go
index dfc5a567b9..2e048c91bb 100644
--- a/go/test/endtoend/vtgate/queries/aggregation/aggregation_test.go
+++ b/go/test/endtoend/vtgate/queries/aggregation/aggregation_test.go
@@ -17,14 +17,15 @@ limitations under the License.
 package aggregation
 
 import (
+	"context"
 	"fmt"
 	"testing"
 
-	"vitess.io/vitess/go/test/endtoend/utils"
-
 	"github.com/stretchr/testify/require"
 
+	"vitess.io/vitess/go/mysql"
 	"vitess.io/vitess/go/test/endtoend/cluster"
+	"vitess.io/vitess/go/test/endtoend/utils"
 )
 
 func start(t *testing.T) (utils.MySQLCompare, func()) {
@@ -296,3 +297,20 @@ func TestGreaterEqualFilterOnScatter(t *testing.T) {
 		})
 	}
 }
+
+func TestGroupByOnlyFullGroupByOff(t *testing.T) {
+	vtParams := mysql.ConnParams{
+		Host: "localhost",
+		Port: clusterInstance.VtgateMySQLPort,
+	}
+	conn, err := mysql.Connect(context.Background(), &vtParams)
+	require.NoError(t, err)
+	defer conn.Close()
+
+	utils.Exec(t, conn, "insert into t9(id1, id2, id3) values(1,'a', '1'), (2,'Abc','2'), (3,'b', '3'), (4,'c', '4'), (5,'test', '5')")
+	utils.Exec(t, conn, "insert into t9(id1, id2, id3) values(6,'a', '11'), (7,'Abc','22'), (8,'b', '33'), (9,'c', '44'), (10,'test', '55')")
+	utils.Exec(t, conn, "set @@sql_mode = ' '")
+
+	// We do not use AssertMatches here because the results for the second column are random
+	utils.Exec(t, conn, "select /*vt+ PLANNER=gen4 */ id2, id3 from t9 group by id2")
+}
diff --git a/go/test/endtoend/vtgate/queries/aggregation/main_test.go b/go/test/endtoend/vtgate/queries/aggregation/main_test.go
index 19d68141d5..6c7a03aecc 100644
--- a/go/test/endtoend/vtgate/queries/aggregation/main_test.go
+++ b/go/test/endtoend/vtgate/queries/aggregation/main_test.go
@@ -48,6 +48,13 @@ create table t3_id7_idx(
     primary key(id)
 ) Engine=InnoDB;
 
+create table t9(
+	id1 bigint,
+	id2 varchar(10),
+	id3 varchar(10),
+	primary key(id1)
+) ENGINE=InnoDB DEFAULT charset=utf8mb4 COLLATE=utf8mb4_general_ci;
+
 create table aggr_test(
 	id bigint,
 	val1 varchar(16),
@@ -127,6 +134,14 @@ create table t7_xxhash_idx(
         }
       ]
     },
+	"t9": {
+      "column_vindexes": [
+        {
+          "column": "id1",
+          "name": "hash"
+        }
+      ]
+	},
 	"aggr_test": {
       "column_vindexes": [
         {
@@ -205,7 +220,7 @@ func TestMain(m *testing.M) {
 		}
 		clusterInstance.VtGateExtraArgs = []string{"--schema_change_signal"}
 		clusterInstance.VtTabletExtraArgs = []string{"--queryserver-config-schema-change-signal", "--queryserver-config-schema-change-signal-interval", "0.1"}
-		err = clusterInstance.StartKeyspace(*keyspace, []string{"-80", "80-"}, 1, true)
+		err = clusterInstance.StartKeyspace(*keyspace, []string{"-80", "80-"}, 0, false)
 		if err != nil {
 			return 1
 		}
diff --git a/go/vt/vtgate/executor_select_test.go b/go/vt/vtgate/executor_select_test.go
index ccab352b40..9b5e1277a2 100644
--- a/go/vt/vtgate/executor_select_test.go
+++ b/go/vt/vtgate/executor_select_test.go
@@ -399,6 +399,49 @@ func TestSetSystemVariables(t *testing.T) {
 	utils.MustMatch(t, wantQueries, lookup.Queries)
 }
 
+func TestSetSystemVariablesWithReservedConnection(t *testing.T) {
+	executor, sbc1, _, _ := createExecutorEnv()
+	executor.normalize = true
+
+	session := NewAutocommitSession(&vtgatepb.Session{EnableSystemSettings: true, SystemVariables: map[string]string{}})
+
+	sbc1.SetResults([]*sqltypes.Result{{
+		Fields: []*querypb.Field{
+			{Name: "orig", Type: sqltypes.VarChar},
+			{Name: "new", Type: sqltypes.VarChar},
+		},
+		Rows: [][]sqltypes.Value{{
+			sqltypes.NewVarChar("only_full_group_by"),
+			sqltypes.NewVarChar(""),
+		}},
+	}})
+	_, err := executor.Execute(context.Background(), "TestSetStmt", session, "set @@sql_mode = ''", map[string]*querypb.BindVariable{})
+	require.NoError(t, err)
+
+	_, err = executor.Execute(context.Background(), "TestSelect", session, "select age, city from user group by age", map[string]*querypb.BindVariable{})
+	require.NoError(t, err)
+	require.True(t, session.InReservedConn())
+	wantQueries := []*querypb.BoundQuery{
+		{Sql: "select @@sql_mode orig, '' new"},
+		{Sql: "set @@sql_mode = ''"},
+		{Sql: "select age, city, weight_string(age) from `user` group by age, weight_string(age) order by age asc"},
+	}
+	utils.MustMatch(t, wantQueries, sbc1.Queries)
+
+	_, err = executor.Execute(context.Background(), "TestSelect", session, "select age, city+1 from user group by age", map[string]*querypb.BindVariable{})
+	require.NoError(t, err)
+	require.True(t, session.InReservedConn())
+	wantQueries = []*querypb.BoundQuery{
+		{Sql: "select @@sql_mode orig, '' new"},
+		{Sql: "set @@sql_mode = ''"},
+		{Sql: "select age, city, weight_string(age) from `user` group by age, weight_string(age) order by age asc"},
+		{Sql: "select age, city + :vtg1, weight_string(age) from `user` group by age, weight_string(age) order by age asc", BindVariables: map[string]*querypb.BindVariable{"vtg1": {Type: sqltypes.Int64, Value: []byte("1")}}},
+	}
+	utils.MustMatch(t, wantQueries, sbc1.Queries)
+	require.Equal(t, "''", session.SystemVariables["sql_mode"])
+	sbc1.Queries = nil
+}
+
 func TestCreateTableValidTimestamp(t *testing.T) {
 	executor, sbc1, _, _ := createExecutorEnv()
 	executor.normalize = true
diff --git a/go/vt/vtgate/planbuilder/abstract/queryprojection_test.go b/go/vt/vtgate/planbuilder/abstract/queryprojection_test.go
index 905398df0b..dc1e40eeff 100644
--- a/go/vt/vtgate/planbuilder/abstract/queryprojection_test.go
+++ b/go/vt/vtgate/planbuilder/abstract/queryprojection_test.go
@@ -39,8 +39,7 @@ func TestQP(t *testing.T) {
 			sql: "select * from user",
 		},
 		{
-			sql:    "select 1, count(1) from user",
-			expErr: "In aggregated query without GROUP BY, expression of SELECT list contains nonaggregated column '1'; this is incompatible with sql_mode=only_full_group_by",
+			sql: "select 1, count(1) from user",
 		},
 		{
 			sql: "select max(id) from user",
@@ -50,8 +49,10 @@ func TestQP(t *testing.T) {
 			expErr: "aggregate functions take a single argument 'max(a, b)'",
 		},
 		{
-			sql:    "select 1, count(1) from user order by 1",
-			expErr: "In aggregated query without GROUP BY, expression of SELECT list contains nonaggregated column '1'; this is incompatible with sql_mode=only_full_group_by",
+			sql: "select 1, count(1) from user order by 1",
+			expOrder: []OrderBy{
+				{Inner: &sqlparser.Order{Expr: sqlparser.NewIntLiteral("1")}, WeightStrExpr: sqlparser.NewIntLiteral("1")},
+			},
 		},
 		{
 			sql: "select id from user order by col, id, 1",
@@ -91,7 +92,7 @@ func TestQP(t *testing.T) {
 			_, err = semantics.Analyze(sel, "", &semantics.FakeSI{})
 			require.NoError(t, err)
 
-			qp, err := CreateQPFromSelect(sel, semantics.EmptySemTable())
+			qp, err := CreateQPFromSelect(sel)
 			if tcase.expErr != "" {
 				require.Error(t, err)
 				require.Contains(t, err.Error(), tcase.expErr)
@@ -198,7 +199,7 @@ func TestQPSimplifiedExpr(t *testing.T) {
 			_, err = semantics.Analyze(sel, "", &semantics.FakeSI{})
 			require.NoError(t, err)
 
-			qp, err := CreateQPFromSelect(sel, semantics.EmptySemTable())
+			qp, err := CreateQPFromSelect(sel)
 			require.NoError(t, err)
 			require.Equal(t, tc.expected[1:], qp.toString())
 		})
diff --git a/go/vt/vtgate/planbuilder/testdata/aggr_cases.txt b/go/vt/vtgate/planbuilder/testdata/aggr_cases.txt
index 13df2feb0e..597a8e0263 100644
--- a/go/vt/vtgate/planbuilder/testdata/aggr_cases.txt
+++ b/go/vt/vtgate/planbuilder/testdata/aggr_cases.txt
@@ -944,7 +944,28 @@ Gen4 plan same as above
     ]
   }
 }
-Gen4 error: In aggregated query without GROUP BY, expression of SELECT list contains nonaggregated column 'id'; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select id, count(*) from user",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Scalar",
+    "Aggregates": "random(0) AS id, sum(1) AS count(*)",
+    "Inputs": [
+      {
+        "OperatorType": "Route",
+        "Variant": "Scatter",
+        "Keyspace": {
+          "Name": "user",
+          "Sharded": true
+        },
+        "FieldQuery": "select id, count(*) from `user` where 1 != 1",
+        "Query": "select id, count(*) from `user`",
+        "Table": "`user`"
+      }
+    ]
+  }
+}
 
 # scatter aggregate using distinctdistinct
 "select distinct col from user"
@@ -1692,7 +1713,31 @@ Gen4 plan same as above
     ]
   }
 }
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'd' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select a, b, c, d, count(*) from user group by 1, 2, 3 order by 1, 2, 3",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Ordered",
+    "Aggregates": "random(3) AS d, sum(4) AS count(*)",
+    "GroupBy": "(0|5), (1|6), (2|7)",
+    "ResultColumns": 5,
+    "Inputs": [
+      {
+        "OperatorType": "Route",
+        "Variant": "Scatter",
+        "Keyspace": {
+          "Name": "user",
+          "Sharded": true
+        },
+        "FieldQuery": "select a, b, c, d, count(*), weight_string(a), weight_string(b), weight_string(c) from `user` where 1 != 1 group by a, weight_string(a), b, weight_string(b), c, weight_string(c)",
+        "OrderBy": "(0|5) ASC, (1|6) ASC, (2|7) ASC",
+        "Query": "select a, b, c, d, count(*), weight_string(a), weight_string(b), weight_string(c) from `user` group by a, weight_string(a), b, weight_string(b), c, weight_string(c) order by a asc, b asc, c asc",
+        "Table": "`user`"
+      }
+    ]
+  }
+}
 
 # scatter aggregate with named order by columns
 "select a, b, c, d, count(*) from user group by 1, 2, 3 order by a, b, c"
@@ -1721,7 +1766,31 @@ Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains non
     ]
   }
 }
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'd' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select a, b, c, d, count(*) from user group by 1, 2, 3 order by a, b, c",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Ordered",
+    "Aggregates": "random(3) AS d, sum(4) AS count(*)",
+    "GroupBy": "(0|5), (1|6), (2|7)",
+    "ResultColumns": 5,
+    "Inputs": [
+      {
+        "OperatorType": "Route",
+        "Variant": "Scatter",
+        "Keyspace": {
+          "Name": "user",
+          "Sharded": true
+        },
+        "FieldQuery": "select a, b, c, d, count(*), weight_string(a), weight_string(b), weight_string(c) from `user` where 1 != 1 group by a, weight_string(a), b, weight_string(b), c, weight_string(c)",
+        "OrderBy": "(0|5) ASC, (1|6) ASC, (2|7) ASC",
+        "Query": "select a, b, c, d, count(*), weight_string(a), weight_string(b), weight_string(c) from `user` group by a, weight_string(a), b, weight_string(b), c, weight_string(c) order by a asc, b asc, c asc",
+        "Table": "`user`"
+      }
+    ]
+  }
+}
 
 # scatter aggregate with jumbled order by columns
 "select a, b, c, d, count(*) from user group by 1, 2, 3, 4 order by d, b, a, c"
@@ -2043,7 +2112,7 @@ Gen4 plan same as above
     ]
   }
 }
-Gen4 error: In aggregated query without GROUP BY, expression of SELECT list contains nonaggregated column 'a'; this is incompatible with sql_mode=only_full_group_by
+Gen4 error: [BUG] unable to plan distinct query as the column is not projected: a
 
 # distinct and aggregate functions
 "select distinct a, count(*) from user group by a"
@@ -2113,7 +2182,31 @@ Gen4 error: In aggregated query without GROUP BY, expression of SELECT list cont
 # Group by invalid column number (code is duplicated from symab).
 "select id from user group by 1.1"
 "column number is not an int"
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select id from user group by 1.1",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Ordered",
+    "Aggregates": "random(0) AS id",
+    "GroupBy": "1",
+    "ResultColumns": 1,
+    "Inputs": [
+      {
+        "OperatorType": "Route",
+        "Variant": "Scatter",
+        "Keyspace": {
+          "Name": "user",
+          "Sharded": true
+        },
+        "FieldQuery": "select id, 1.1 from `user` where 1 != 1 group by 1.1",
+        "OrderBy": "1 ASC",
+        "Query": "select id, 1.1 from `user` group by 1.1 order by 1.1 asc",
+        "Table": "`user`"
+      }
+    ]
+  }
+}
 
 # Group by out of range column number (code is duplicated from symab).
 "select id from user group by 2"
diff --git a/go/vt/vtgate/planbuilder/testdata/memory_sort_cases.txt b/go/vt/vtgate/planbuilder/testdata/memory_sort_cases.txt
index e1f0703e80..d117545164 100644
--- a/go/vt/vtgate/planbuilder/testdata/memory_sort_cases.txt
+++ b/go/vt/vtgate/planbuilder/testdata/memory_sort_cases.txt
@@ -35,7 +35,31 @@
     ]
   }
 }
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'b' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select a, b, count(*) from user group by a order by b",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Ordered",
+    "Aggregates": "random(1) AS b, sum(2) AS count(*)",
+    "GroupBy": "(0|3)",
+    "ResultColumns": 3,
+    "Inputs": [
+      {
+        "OperatorType": "Route",
+        "Variant": "Scatter",
+        "Keyspace": {
+          "Name": "user",
+          "Sharded": true
+        },
+        "FieldQuery": "select a, b, count(*), weight_string(a), weight_string(b) from `user` where 1 != 1 group by a, weight_string(a)",
+        "OrderBy": "(1|4) ASC, (0|3) ASC",
+        "Query": "select a, b, count(*), weight_string(a), weight_string(b) from `user` group by a, weight_string(a) order by b asc, a asc",
+        "Table": "`user`"
+      }
+    ]
+  }
+}
 
 # scatter aggregate order by references aggregate expression
 "select a, b, count(*) k from user group by a order by k"
@@ -71,9 +95,39 @@ Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains non
     ]
   }
 }
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'b' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select a, b, count(*) k from user group by a order by k",
+  "Instructions": {
+    "OperatorType": "Sort",
+    "Variant": "Memory",
+    "OrderBy": "2 ASC",
+    "ResultColumns": 3,
+    "Inputs": [
+      {
+        "OperatorType": "Aggregate",
+        "Variant": "Ordered",
+        "Aggregates": "random(1) AS b, sum(2) AS k",
+        "GroupBy": "(0|3)",
+        "Inputs": [
+          {
+            "OperatorType": "Route",
+            "Variant": "Scatter",
+            "Keyspace": {
+              "Name": "user",
+              "Sharded": true
+            },
+            "FieldQuery": "select a, b, count(*) as k, weight_string(a) from `user` where 1 != 1 group by a, weight_string(a)",
+            "OrderBy": "(0|3) ASC",
+            "Query": "select a, b, count(*) as k, weight_string(a) from `user` group by a, weight_string(a) order by a asc",
+            "Table": "`user`"
+          }
+        ]
+      }
+    ]
+  }
+}
 
-# scatter aggregate order by references multiple non-group-by expressions
 "select a, b, count(*) k from user group by a order by b, a, k"
 {
   "QueryType": "SELECT",
@@ -109,7 +163,38 @@ Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains non
     ]
   }
 }
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'b' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select a, b, count(*) k from user group by a order by b, a, k",
+  "Instructions": {
+    "OperatorType": "Sort",
+    "Variant": "Memory",
+    "OrderBy": "1 ASC, (0|3) ASC, 2 ASC",
+    "ResultColumns": 3,
+    "Inputs": [
+      {
+        "OperatorType": "Aggregate",
+        "Variant": "Ordered",
+        "Aggregates": "random(1) AS b, sum(2) AS k",
+        "GroupBy": "(0|3)",
+        "Inputs": [
+          {
+            "OperatorType": "Route",
+            "Variant": "Scatter",
+            "Keyspace": {
+              "Name": "user",
+              "Sharded": true
+            },
+            "FieldQuery": "select a, b, count(*) as k, weight_string(a) from `user` where 1 != 1 group by a, weight_string(a)",
+            "OrderBy": "(0|3) ASC",
+            "Query": "select a, b, count(*) as k, weight_string(a) from `user` group by a, weight_string(a) order by a asc",
+            "Table": "`user`"
+          }
+        ]
+      }
+    ]
+  }
+}
 
 # scatter aggregate with memory sort and limit
 "select a, b, count(*) k from user group by a order by k desc limit 10"
@@ -151,7 +236,44 @@ Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains non
     ]
   }
 }
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'b' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select a, b, count(*) k from user group by a order by k desc limit 10",
+  "Instructions": {
+    "OperatorType": "Limit",
+    "Count": "INT64(10)",
+    "Inputs": [
+      {
+        "OperatorType": "Sort",
+        "Variant": "Memory",
+        "OrderBy": "2 DESC",
+        "ResultColumns": 3,
+        "Inputs": [
+          {
+            "OperatorType": "Aggregate",
+            "Variant": "Ordered",
+            "Aggregates": "random(1) AS b, sum(2) AS k",
+            "GroupBy": "(0|3)",
+            "Inputs": [
+              {
+                "OperatorType": "Route",
+                "Variant": "Scatter",
+                "Keyspace": {
+                  "Name": "user",
+                  "Sharded": true
+                },
+                "FieldQuery": "select a, b, count(*) as k, weight_string(a) from `user` where 1 != 1 group by a, weight_string(a)",
+                "OrderBy": "(0|3) ASC",
+                "Query": "select a, b, count(*) as k, weight_string(a) from `user` group by a, weight_string(a) order by a asc",
+                "Table": "`user`"
+              }
+            ]
+          }
+        ]
+      }
+    ]
+  }
+}
 
 # scatter aggregate with memory sort and order by number
 "select a, b, count(*) k from user group by a order by 1,3"
@@ -189,7 +311,38 @@ Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains non
     ]
   }
 }
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'b' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select a, b, count(*) k from user group by a order by 1,3",
+  "Instructions": {
+    "OperatorType": "Sort",
+    "Variant": "Memory",
+    "OrderBy": "(0|3) ASC, 2 ASC",
+    "ResultColumns": 3,
+    "Inputs": [
+      {
+        "OperatorType": "Aggregate",
+        "Variant": "Ordered",
+        "Aggregates": "random(1) AS b, sum(2) AS k",
+        "GroupBy": "(0|3)",
+        "Inputs": [
+          {
+            "OperatorType": "Route",
+            "Variant": "Scatter",
+            "Keyspace": {
+              "Name": "user",
+              "Sharded": true
+            },
+            "FieldQuery": "select a, b, count(*) as k, weight_string(a) from `user` where 1 != 1 group by a, weight_string(a)",
+            "OrderBy": "(0|3) ASC",
+            "Query": "select a, b, count(*) as k, weight_string(a) from `user` group by a, weight_string(a) order by a asc",
+            "Table": "`user`"
+          }
+        ]
+      }
+    ]
+  }
+}
 
 # scatter aggregate with memory sort and order by number, reuse weight_string
 # we have to use a meaningless construct to test this. TODO: improve to do ordering once for textcol1
diff --git a/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt b/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt
index 97655e8236..af723e5177 100644
--- a/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt
+++ b/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt
@@ -1853,7 +1853,28 @@ Gen4 plan same as above
     ]
   }
 }
-Gen4 error: In aggregated query without GROUP BY, expression of SELECT list contains nonaggregated column 'num'; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select count(id), num from user",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Scalar",
+    "Aggregates": "sum(0) AS count(id), random(1) AS num",
+    "Inputs": [
+      {
+        "OperatorType": "Route",
+        "Variant": "Scatter",
+        "Keyspace": {
+          "Name": "user",
+          "Sharded": true
+        },
+        "FieldQuery": "select count(id), num from `user` where 1 != 1",
+        "Query": "select count(id), num from `user`",
+        "Table": "`user`"
+      }
+    ]
+  }
+}
 
 # aggregation and non-aggregations column with order by
 "select count(id), num from user order by 2"
@@ -1888,7 +1909,30 @@ Gen4 error: In aggregated query without GROUP BY, expression of SELECT list cont
     ]
   }
 }
-Gen4 error: In aggregated query without GROUP BY, expression of SELECT list contains nonaggregated column 'num'; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select count(id), num from user order by 2",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Scalar",
+    "Aggregates": "sum(0) AS count(id), random(1) AS num",
+    "ResultColumns": 2,
+    "Inputs": [
+      {
+        "OperatorType": "Route",
+        "Variant": "Scatter",
+        "Keyspace": {
+          "Name": "user",
+          "Sharded": true
+        },
+        "FieldQuery": "select count(id), num, weight_string(num) from `user` where 1 != 1",
+        "OrderBy": "(1|2) ASC",
+        "Query": "select count(id), num, weight_string(num) from `user` order by num asc",
+        "Table": "`user`"
+      }
+    ]
+  }
+}
 
 # aggregation and non-aggregations column with group by
 "select count(id), num from user group by 2"
@@ -2073,7 +2117,31 @@ Gen4 error: In aggregated query without GROUP BY, expression of SELECT list cont
 # Scatter order by and aggregation: order by column must reference column from select list
 "select col, count(*) from user group by col order by c1"
 "unsupported: memory sort: order by must reference a column in the select list: c1 asc"
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'c1' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select col, count(*) from user group by col order by c1",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Ordered",
+    "Aggregates": "sum(1) AS count(*), random(2)",
+    "GroupBy": "0",
+    "ResultColumns": 2,
+    "Inputs": [
+      {
+        "OperatorType": "Route",
+        "Variant": "Scatter",
+        "Keyspace": {
+          "Name": "user",
+          "Sharded": true
+        },
+        "FieldQuery": "select col, count(*), c1, weight_string(c1) from `user` where 1 != 1 group by col",
+        "OrderBy": "(2|3) ASC, 0 ASC",
+        "Query": "select col, count(*), c1, weight_string(c1) from `user` group by col order by c1 asc, col asc",
+        "Table": "`user`"
+      }
+    ]
+  }
+}
 
 # Distinct with cross shard query
 "select distinct user.a from user join user_extra"
diff --git a/go/vt/vtgate/planbuilder/testdata/unsupported_cases.txt b/go/vt/vtgate/planbuilder/testdata/unsupported_cases.txt
index 03142ae620..c9a2cc9361 100644
--- a/go/vt/vtgate/planbuilder/testdata/unsupported_cases.txt
+++ b/go/vt/vtgate/planbuilder/testdata/unsupported_cases.txt
@@ -71,12 +71,36 @@ Gen4 error: cannot use column offsets in group statement when using `*`
 # group by must reference select list
 "select a from user group by b"
 "unsupported: in scatter query: group by column must reference column in SELECT list"
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'a' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select a from user group by b",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Ordered",
+    "Aggregates": "random(0) AS a",
+    "GroupBy": "(1|2)",
+    "ResultColumns": 1,
+    "Inputs": [
+      {
+        "OperatorType": "Route",
+        "Variant": "Scatter",
+        "Keyspace": {
+          "Name": "user",
+          "Sharded": true
+        },
+        "FieldQuery": "select a, b, weight_string(b) from `user` where 1 != 1 group by b, weight_string(b)",
+        "OrderBy": "(1|2) ASC",
+        "Query": "select a, b, weight_string(b) from `user` group by b, weight_string(b) order by b asc",
+        "Table": "`user`"
+      }
+    ]
+  }
+}
 
 # complex group by expression
 "select a from user group by a+1"
 "unsupported: in scatter query: only simple references allowed"
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'a' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+Gen4 error: unsupported: in scatter query: complex order by expression: a + 1
 
 # Complex aggregate expression on scatter
 "select 1+count(*) from user"
@@ -91,7 +115,30 @@ Gen4 error: aggregate functions take a single argument 'count(a, b)'
 # scatter aggregate symtab lookup error
 "select id, b as id, count(*) from user order by id"
 "ambiguous symbol reference: id"
-Gen4 error: In aggregated query without GROUP BY, expression of SELECT list contains nonaggregated column 'id'; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select id, b as id, count(*) from user order by id",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Scalar",
+    "Aggregates": "random(0) AS id, random(0) AS id, sum(2) AS count(*)",
+    "ResultColumns": 3,
+    "Inputs": [
+      {
+        "OperatorType": "Route",
+        "Variant": "Scatter",
+        "Keyspace": {
+          "Name": "user",
+          "Sharded": true
+        },
+        "FieldQuery": "select id, b as id, count(*), weight_string(b) from `user` where 1 != 1",
+        "OrderBy": "(1|3) ASC",
+        "Query": "select id, b as id, count(*), weight_string(b) from `user` order by id asc",
+        "Table": "`user`"
+      }
+    ]
+  }
+}
 
 # scatter aggregate complex order by
 "select id from user group by id order by id+1"
@@ -101,7 +148,7 @@ Gen4 plan same as above
 # Scatter order by is complex with aggregates in select
 "select col, count(*) from user group by col order by col+1"
 "unsupported: in scatter query: complex order by expression: col + 1"
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column 'col + 1' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+Gen4 plan same as above
 
 # Aggregate detection (group_concat)
 "select group_concat(user.a) from user join user_extra"
@@ -111,12 +158,121 @@ Gen4 error: unsupported: in scatter query: complex aggregate expression
 # group by and ',' joins
 "select user.id from user, user_extra group by id"
 "unsupported: cross-shard query with aggregates"
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column '`user`.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select user.id from user, user_extra group by id",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Ordered",
+    "Aggregates": "random(0) AS id",
+    "GroupBy": "(2|1)",
+    "ResultColumns": 1,
+    "Inputs": [
+      {
+        "OperatorType": "Projection",
+        "Expressions": [
+          "[COLUMN 2] * [COLUMN 3] as id",
+          "[COLUMN 1]",
+          "[COLUMN 0] as id"
+        ],
+        "Inputs": [
+          {
+            "OperatorType": "Join",
+            "Variant": "Join",
+            "JoinColumnIndexes": "L:0,L:1,L:0,R:0",
+            "TableName": "`user`_user_extra",
+            "Inputs": [
+              {
+                "OperatorType": "Route",
+                "Variant": "Scatter",
+                "Keyspace": {
+                  "Name": "user",
+                  "Sharded": true
+                },
+                "FieldQuery": "select `user`.id, weight_string(id) from `user` where 1 != 1 group by id, weight_string(id)",
+                "OrderBy": "(0|1) ASC",
+                "Query": "select `user`.id, weight_string(id) from `user` group by id, weight_string(id) order by id asc",
+                "Table": "`user`"
+              },
+              {
+                "OperatorType": "Route",
+                "Variant": "Scatter",
+                "Keyspace": {
+                  "Name": "user",
+                  "Sharded": true
+                },
+                "FieldQuery": "select count(*) from user_extra where 1 != 1",
+                "Query": "select count(*) from user_extra",
+                "Table": "user_extra"
+              }
+            ]
+          }
+        ]
+      }
+    ]
+  }
+}
 
 # group by and ',' joins with condition
 "select user.col from user join user_extra on user_extra.col = user.col group by user.id"
 "unsupported: cross-shard query with aggregates"
-Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column '`user`.col' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select user.col from user join user_extra on user_extra.col = user.col group by user.id",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Ordered",
+    "Aggregates": "random(0) AS col",
+    "GroupBy": "(2|1)",
+    "ResultColumns": 1,
+    "Inputs": [
+      {
+        "OperatorType": "Projection",
+        "Expressions": [
+          "[COLUMN 2] * [COLUMN 3] as col",
+          "[COLUMN 1]",
+          "[COLUMN 0] as id"
+        ],
+        "Inputs": [
+          {
+            "OperatorType": "Join",
+            "Variant": "Join",
+            "JoinColumnIndexes": "L:2,L:3,L:1,R:0",
+            "JoinVars": {
+              "user_col": 0
+            },
+            "TableName": "`user`_user_extra",
+            "Inputs": [
+              {
+                "OperatorType": "Route",
+                "Variant": "Scatter",
+                "Keyspace": {
+                  "Name": "user",
+                  "Sharded": true
+                },
+                "FieldQuery": "select `user`.col, `user`.col, `user`.id, weight_string(`user`.id) from `user` where 1 != 1 group by `user`.col, `user`.id, weight_string(`user`.id)",
+                "OrderBy": "(2|3) ASC",
+                "Query": "select `user`.col, `user`.col, `user`.id, weight_string(`user`.id) from `user` group by `user`.col, `user`.id, weight_string(`user`.id) order by `user`.id asc",
+                "Table": "`user`"
+              },
+              {
+                "OperatorType": "Route",
+                "Variant": "Scatter",
+                "Keyspace": {
+                  "Name": "user",
+                  "Sharded": true
+                },
+                "FieldQuery": "select count(*) from user_extra where 1 != 1",
+                "Query": "select count(*) from user_extra where user_extra.col = :user_col",
+                "Table": "user_extra"
+              }
+            ]
+          }
+        ]
+      }
+    ]
+  }
+}
 
 # subqueries not supported in group by
 "select id from user group by id, (select id from user_extra)"
@@ -435,7 +591,28 @@ Gen4 plan same as above
     ]
   }
 }
-Gen4 error: In aggregated query without GROUP BY, expression of SELECT list contains nonaggregated column 'id'; this is incompatible with sql_mode=only_full_group_by
+{
+  "QueryType": "SELECT",
+  "Original": "select id, count(*) from user",
+  "Instructions": {
+    "OperatorType": "Aggregate",
+    "Variant": "Scalar",
+    "Aggregates": "random(0) AS id, sum(1) AS count(*)",
+    "Inputs": [
+      {
+        "OperatorType": "Route",
+        "Variant": "Scatter",
+        "Keyspace": {
+          "Name": "user",
+          "Sharded": true
+        },
+        "FieldQuery": "select id, count(*) from `user` where 1 != 1",
+        "Query": "select id, count(*) from `user`",
+        "Table": "`user`"
+      }
+    ]
+  }
+}
 
 # avg function on scatter query
 "select avg(id) from user"