Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pingcap/parser into admin…
Browse files Browse the repository at this point in the history
…_reload
  • Loading branch information
XuHuaiyu committed Jun 12, 2019
2 parents c4f310a + 939965d commit b2b647f
Show file tree
Hide file tree
Showing 11 changed files with 7,960 additions and 7,027 deletions.
556 changes: 505 additions & 51 deletions ast/ddl.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ast/expressions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func (tc *testExpressionsSuite) TestMaxValueExprRestore(c *C) {
{"maxvalue", "MAXVALUE"},
}
extractNodeFunc := func(node Node) Node {
return node.(*AlterTableStmt).Specs[0].PartDefinitions[0].LessThan[0]
return node.(*AlterTableStmt).Specs[0].PartDefinitions[0].Clause.(*PartitionDefinitionClauseLessThan).Exprs[0]
}
RunNodeRestoreTest(c, testCases, "alter table posts add partition ( partition p1 values less than %s)", extractNodeFunc)
}
Expand Down
5 changes: 5 additions & 0 deletions misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ var tokenMap = map[string]int{
"DELETE": deleteKwd,
"DESC": desc,
"DESCRIBE": describe,
"DIRECTORY": directory,
"DISABLE": disable,
"DISTINCT": distinct,
"DISTINCTROW": distinct,
Expand Down Expand Up @@ -289,6 +290,7 @@ var tokenMap = map[string]int{
"HASH": hash,
"HAVING": having,
"HIGH_PRIORITY": highPriority,
"HISTORY": history,
"HOUR": hour,
"HOUR_MICROSECOND": hourMicrosecond,
"HOUR_MINUTE": hourMinute,
Expand Down Expand Up @@ -338,6 +340,7 @@ var tokenMap = map[string]int{
"LIMIT": limit,
"LINES": lines,
"LINEAR": linear,
"LIST": list,
"LOAD": load,
"LOCAL": local,
"LOCALTIME": localTime,
Expand Down Expand Up @@ -380,6 +383,7 @@ var tokenMap = map[string]int{
"NO_WRITE_TO_BINLOG": noWriteToBinLog,
"NODE_ID": nodeID,
"NODE_STATE": nodeState,
"NODEGROUP": nodegroup,
"NONE": none,
"NOT": not,
"NOW": now,
Expand Down Expand Up @@ -489,6 +493,7 @@ var tokenMap = map[string]int{
"STATUS": status,
"SWAPS": swaps,
"SWITCHES": switchesSym,
"SYSTEM_TIME": systemTime,
"OPEN": open,
"STD": stddevPop,
"STDDEV": stddevPop,
Expand Down
2 changes: 2 additions & 0 deletions model/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ const (
FlagIgnoreZeroInDate = 1 << 7
// FlagDividedByZeroAsWarning indicates if DividedByZero should be returned as warning.
FlagDividedByZeroAsWarning = 1 << 8
// FlagInUnionStmt indicates if this is a UNION statement.
FlagInUnionStmt = 1 << 9
)
12 changes: 9 additions & 3 deletions model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,11 @@ type PartitionType int

// Partition types.
const (
PartitionTypeRange PartitionType = 1
PartitionTypeHash PartitionType = 2
PartitionTypeList PartitionType = 3
PartitionTypeRange PartitionType = 1
PartitionTypeHash = 2
PartitionTypeList = 3
PartitionTypeKey = 4
PartitionTypeSystemTime = 5
)

func (p PartitionType) String() string {
Expand All @@ -558,6 +560,10 @@ func (p PartitionType) String() string {
return "HASH"
case PartitionTypeList:
return "LIST"
case PartitionTypeKey:
return "KEY"
case PartitionTypeSystemTime:
return "SYSTEM_TIME"
default:
return ""
}
Expand Down
5 changes: 5 additions & 0 deletions mysql/errcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,11 @@ const (
ErrWindowExplainJson = 3598
ErrWindowFunctionIgnoresFrame = 3599

// MariaDB errors.
ErrOnlyOneDefaultPartionAllowed = 4030
ErrWrongPartitionTypeExpectedSystemTime = 4113
ErrSystemVersioningWrongPartitions = 4128

// TiDB self-defined errors.
ErrMemExceedThreshold = 8001
ErrForUpdateCantRetry = 8002
Expand Down
5 changes: 5 additions & 0 deletions mysql/errname.go
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,11 @@ var MySQLErrName = map[uint16]string{
ErrRoleNotGranted: "%s is is not granted to %s",
ErrMaxExecTimeExceeded: "Query execution was interrupted, max_execution_time exceeded.",

// MariaDB errors.
ErrOnlyOneDefaultPartionAllowed: "Only one DEFAULT partition allowed",
ErrWrongPartitionTypeExpectedSystemTime: "Wrong partitioning type, expected type: `SYSTEM_TIME`",
ErrSystemVersioningWrongPartitions: "Wrong Partitions: must have at least one HISTORY and exactly one last CURRENT",

// TiDB errors.
ErrMemExceedThreshold: "%s holds %dB memory, exceeds threshold %dB.%s",
ErrForUpdateCantRetry: "[%d] can not retry select for update statement",
Expand Down
Loading

0 comments on commit b2b647f

Please sign in to comment.