Commit Graph

18302 Commits

Author SHA1 Message Date
c95be4aaa6 [parser] auth: caching_sha2_password salt fix (#1249)
- a NUL or '$' could get replaced with another NUL or '$'
- Replacement characters didn't get their first bit set to 0 (`&^ 128`)
- The test case used the index number instead of the value of the rune.
2021-10-09 14:53:23 +08:00
4415136781 [parser] auth: check for NUL in caching_sha2_password salt (#1246) 2021-10-09 14:53:23 +08:00
768ee171c1 [parser] auth: Fix salt generation of caching_sha2_password (#1242)
This code intended to set the first bit of every byte of the salt
to 0 as the salt should not contain multi-byte UTF-8.

However it failed to do this. This changes the `^` with a `^&` to fix
that.

In addition to that this also avoids the '$' inside salts as that is
already used as delimiter in the authentication string.

Co-authored-by: tiancaiamao <tiancaiamao@gmail.com>
2021-10-09 14:53:23 +08:00
eedf0439ca [parser] *: fix cte restore for binding (#1244)
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
2021-10-09 14:53:23 +08:00
f5033cdbf5 [parser] CI: Use Go 1.16 instead of Go 1.13 (#1241)
The Integration Test output currently has this:

```
note: module requires Go 1.16
```
2021-10-09 14:53:23 +08:00
12d0a279c4 [parser] parser,ast: Support for authentication plugins (#1236) 2021-10-09 14:53:23 +08:00
8d23ad21c9 [parser] auth: add the caching sha2 algorithm for authentication (#1232)
This allows validating passwords against the `authentication_string`
data that MySQL stores for caching_sha2 passwords.

Related:
- https://github.com/pingcap/tidb/issues/9411
2021-10-09 14:53:23 +08:00
43d29d74f7 [parser] README: remove TiDB Monthly (#1233) 2021-10-09 14:53:23 +08:00
732586d33f [parser] *: clean up the deserted syntax of START TRANSACTION READ ONLY (#1230)
* Clean up the deserted syntax of START TRANSACTION READ ONLY

Signed-off-by: JmPotato <ghzpotato@gmail.com>
2021-10-09 14:53:23 +08:00
6b60fb9717 [parser] *: Add Digest struct to get bytes of digest (#1231) 2021-10-09 14:53:23 +08:00
62174bb0ae [parser] fix lexer bug (#1228)
Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
2021-10-09 14:53:23 +08:00
528cb4f912 [parser] remove duplicated (#1229)
Signed-off-by: yisaer <disxiaofei@163.com>
2021-10-09 14:53:23 +08:00
e8aea0f97d [parser] parser: add AsOfClause for START TRANSACTION READ ONLY statement (#1215)
* Add AsOfClause for START TRANSACTION READ ONLY statement

Signed-off-by: JmPotato <ghzpotato@gmail.com>
2021-10-09 14:53:23 +08:00
2025bc4d3e [parser] ast: make AsOf node be accepted (#1226)
* ast: make AsOf node be accepted

Signed-off-by: nolouch <nolouch@gmail.com>
2021-10-09 14:53:23 +08:00
0c43f7f38c [parser] parser, ast: make parser happy for PARTITION BY [LINEAR] KEY ALGORITHM syntax (#1221)
* parser, ast: make parser happy for PARTITION BY [LINEAR] KEY ALGORITHM synta

* Update ast/ddl.go

Co-authored-by: kennytm <kennytm@gmail.com>

* remove useless import

Co-authored-by: kennytm <kennytm@gmail.com>
2021-10-09 14:53:23 +08:00
8dfa8f1136 [parser] parser: Compatible with mysql fix select 1 group by 1 (#1223) 2021-10-09 14:53:23 +08:00
397683047e [parser] parser: Fix tidb issue 24439 Inconsistent error with MySQL for GRANT CREATE USER ON <specific db>.* (#1224)
* add StaticGlobalOnlyPrivs

* fix
2021-10-09 14:53:23 +08:00
434ae88964 [parser] ast: add resultSetNode() to ResultSetNode (#1216)
Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
2021-10-09 14:53:23 +08:00
ed312bd0dd [parser] lexer: fix lexer get wrong token (#1222) 2021-10-09 14:53:23 +08:00
c72868080c [parser] fix CTE parser (#1217)
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
2021-10-09 14:53:23 +08:00
fd730ec231 [parser] parser: support the 'create global temporary table' syntax (#1211) 2021-10-09 14:53:23 +08:00
c298f32dd3 [parser] ddl: admin show ddl jobs output confusing with multiple jobs (#1210)
* change "none" 2 "queueing"

Signed-off-by: lihaowei <haoweili35@gmail.com>

* 4 review

Signed-off-by: lihaowei <haoweili35@gmail.com>

* restore origin word

* *: change none 2 queueing
2021-10-09 14:53:23 +08:00
6a97668216 [parser] ast: visit Join.Using in Join.Accept (#1214) 2021-10-09 14:53:23 +08:00
b6c5ada1d5 [parser] *: add as of clause for SET and SELECT (#1206)
* *: add as of clause

Signed-off-by: nolouch <nolouch@gmail.com>

* resolve shift-reduce conflict

* *: fix and try to add test

Signed-off-by: nolouch <nolouch@gmail.com>

* *: add timestamp

Signed-off-by: nolouch <nolouch@gmail.com>

* make as of to token

Signed-off-by: nolouch <nolouch@gmail.com>

* address comments

Signed-off-by: nolouch <nolouch@gmail.com>

* add test

Signed-off-by: nolouch <nolouch@gmail.com>

* make of as Reserved(from mysql 8.0)

Signed-off-by: nolouch <nolouch@gmail.com>

* add set test case

Signed-off-by: nolouch <nolouch@gmail.com>

* address comment

Signed-off-by: nolouch <nolouch@gmail.com>

Co-authored-by: tangenta <tangenta@126.com>
2021-10-09 14:53:23 +08:00
67b2a63ac9 [parser] Add EnumSetAsIntFlag flag to control enum behavior. (#1165)
* add enumset as int flag

* update evaltype

* add has function

* Update mysql/type.go

Co-authored-by: tangenta <tangenta@126.com>

Co-authored-by: tangenta <tangenta@126.com>
2021-10-09 14:53:23 +08:00
81fcae6419 [parser] ast: fix testPlanSuite.TestNameResolver failed in tidb repo (#1212)
* fix-name-resolver

* add comments
2021-10-09 14:53:23 +08:00
ccf996259d [parser] support CTE clause (#1207) 2021-10-09 14:53:23 +08:00
f09db3e3ce [parser] feat: force_index hint (#1205) 2021-10-09 14:53:23 +08:00
xhe
bc860cdd5e [parser] *: fix static check report (#1195)
* ast: base.go

Signed-off-by: xhe <xw897002528@gmail.com>

* ast: expressions.go

Signed-off-by: xhe <xw897002528@gmail.com>

* ast: misc_test.go

Signed-off-by: xhe <xw897002528@gmail.com>

* *: digester.go

Signed-off-by: xhe <xw897002528@gmail.com>

* goyacc: format_yacc.go

Signed-off-by: xhe <xw897002528@gmail.com>

* *: lexer_test.go

Signed-off-by: xhe <xw897002528@gmail.com>

* *: misc.go

Signed-off-by: xhe <xw897002528@gmail.com>

* model: model.go

Signed-off-by: xhe <xw897002528@gmail.com>

* model: model_test.go

Signed-off-by: xhe <xw897002528@gmail.com>

* *: parser_test.go

Signed-off-by: xhe <xw897002528@gmail.com>

* test_driver: test_driver_datum.go

Signed-off-by: xhe <xw897002528@gmail.com>

* test_driver: test_driver_mydecimal.go

Signed-off-by: xhe <xw897002528@gmail.com>

* ast: ddl.go, bugfix

Signed-off-by: xhe <xw897002528@gmail.com>

* mysql: errcode.go

charset/charset.go is passing errcode to NewStd, which requires int. But
here codes are uint16. To get rid of the error, uint16 is removed.

Signed-off-by: xhe <xw897002528@gmail.com>

* model: better test

Signed-off-by: xhe <xw897002528@gmail.com>

* *: fix timezone

Signed-off-by: xhe <xw897002528@gmail.com>

Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
2021-10-09 14:53:23 +08:00
940fbea282 [parser] parser, ast: add RENAME USER stmt (#1204) 2021-10-09 14:53:23 +08:00
5f6739c14e [parser] mysql: modify TypeNewDecimal length in defaultLengthAndDecimalForCast (#1202) 2021-10-09 14:53:23 +08:00
xhe
0b7ab92e3a [parser] mysql: small privileges refactor (#1198)
* mysql: extract privs out

Signed-off-by: xhe <xw897002528@gmail.com>

* mysql: add priv.String()

Signed-off-by: xhe <xw897002528@gmail.com>

* mysql: add privs.Has()

Signed-off-by: xhe <xw897002528@gmail.com>

* mysql: add p.SetString() and p.ColumnString()

Signed-off-by: xhe <xw897002528@gmail.com>

* mysql: add NewPrivFromSetEnum/Column

Signed-off-by: xhe <xw897002528@gmail.com>

* *: add license

Co-authored-by: kennytm <kennytm@gmail.com>

* *: complete the license

Signed-off-by: xhe <xw897002528@gmail.com>

Co-authored-by: kennytm <kennytm@gmail.com>
Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
2021-10-09 14:53:23 +08:00
c80bc1e8f9 [parser] parser, ast: add explain for ALTER TABLE (#1196)
Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
2021-10-09 14:53:23 +08:00
xhe
8112420b91 [parser] mysql: add create_view to tables_priv (#1201)
Signed-off-by: xhe <xw897002528@gmail.com>

Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
2021-10-09 14:53:23 +08:00
a276562af7 [parser] auth: fix CheckScrambledPassword() panic for invalid input (#1197)
* auth: fix CheckScrambledPassword() panic for invalid input

* fix CI

Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
2021-10-09 14:53:23 +08:00
568cdcc4bd [parser] downgrade mysql driver version (#1193)
* downgrade mysql driver version

* use v1.4.1

* use v1.3.0
2021-10-09 14:53:23 +08:00
5020689f09 [parser] parser: Add truncate all support (#1179)
* remove warning
* make parser
2021-10-09 14:53:23 +08:00
8cd0659690 [parser] set right not null flag when newing extra PK (#1189)
* set right not null flag when newing extra PK

* add test

* fmt

Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
2021-10-09 14:53:23 +08:00
4bc38d9c99 [parser] privileges: show create view privilege should in AllTablePrivs (#1182)
Co-authored-by: jwxiong <xiongjiwei1996@outlook.com>
2021-10-09 14:53:23 +08:00
7515d165a3 [parser] parser: regard NULL as literal when normalizing query (#1166)
* parser: regard NULL as literal when normalizing queries

Currently, Normalize() converts "SELECT NULL" to "select null", while NULL is
regarded as a literal in MySQL, as described in the documentation.
https://dev.mysql.com/doc/refman/8.0/en/literals.html
It seems natural that Normalize() would convert "SELECT NULL" to "select ?"
from the consistency viewpoint.

* Handle case of 'select `null`'

* Fix quotation

Co-authored-by: Arenatlx <ailinsilence4@gmail.com>
Co-authored-by: kennytm <kennytm@gmail.com>
2021-10-09 14:53:23 +08:00
bb256c7e19 [parser] format: add RestoreStringWithoutCharset flag (#1184)
Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
2021-10-09 14:53:23 +08:00
0ab86feca6 [parser] add ActionType: ActionDropIndexes (#1186) 2021-10-09 14:53:23 +08:00
a27471d6df [parser] statistics: introduce a new kind of syntax to drop global-stats #1181 2021-10-09 14:53:23 +08:00
cead7b3c5d [parser] parser: support show stats_extended syntax (#1178) 2021-10-09 14:53:23 +08:00
747a99dd53 [parser] add the new stmt: drop stats partition (#1177) 2021-10-09 14:53:23 +08:00
10b601cc69 [parser] restore: fix the bug about restore join table generate syntax error SQL (#1173) 2021-10-09 14:53:23 +08:00
b3efddbbec [parser] digest: add missed backquote when getting digest (#1176)
* fix test

* add test
2021-10-09 14:53:23 +08:00
9c4959a061 [parser] lexer: quote identifier when get sql digest (#1151)
* fix

* fix

* Update digester.go

Co-authored-by: kennytm <kennytm@gmail.com>

Co-authored-by: kennytm <kennytm@gmail.com>
2021-10-09 14:53:23 +08:00
51f162cf17 [parser] model: add a version for the clustered index (#1172) 2021-10-09 14:53:23 +08:00
1f210fe678 [parser] model: add a new TableInfoVersion for separating id allocators (#1170) 2021-10-09 14:53:23 +08:00