pingcap / pingcap/tidb

Support for collation with ID>255

Open
#52,996 0 comments 0 reactions 0 assignees View on GitHub
component/charset component/parser severity/minor sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Many places use a `int` or `uint8` for the Collation ID. This breaks collations with an ID above 255.

```
$ git grep -iE 'collation *(uint8|int)(,|$|\ )'
pkg/server/conn.go: collation uint8 // collation used by client, may be different from the collation used by database.
pkg/server/driver.go: OpenCtx(connID uint64, capability uint32, collation uint8, dbname string, tlsState *tls.ConnectionState, extensions *extension.SessionExtensions) (*TiDBContext, error)
pkg/server/driver_tidb.go:func (qd *TiDBDriver) OpenCtx(connID uint64, capability uint32, collation uint8, _ string,
pkg/server/internal/handshake/handshake.go: Collation uint8
```

https://github.com/pingcap/tidb/blob/c60f97d16c6ff981b16279254ddee0f6b0e8ef19/pkg/parser/charset/charset.go#L47

Also there is quite a bit of duplication between these:
- `pkg/parser/mysql/charset.go`
- `pkg/parser/charset/charset.go`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.