Skip to content

Commit

Permalink
fix test and format
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyifan committed Feb 4, 2021
1 parent 0d23a7e commit adb7015
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 115 deletions.
164 changes: 82 additions & 82 deletions errno/errcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,88 +908,88 @@ const (
ErrWrongInsertIntoSequence = 4140
ErrSequenceInvalidTableStructure = 4141
// TiDB self-defined errors.
ErrMemExceedThreshold = 8001
ErrForUpdateCantRetry = 8002
ErrAdminCheckTable = 8003
ErrTxnTooLarge = 8004
ErrWriteConflictInTiDB = 8005
ErrUnsupportedReloadPlugin = 8018
ErrUnsupportedReloadPluginVar = 8019
ErrTableLocked = 8020
ErrNotExist = 8021
ErrTxnRetryable = 8022
ErrCannotSetNilValue = 8023
ErrInvalidTxn = 8024
ErrEntryTooLarge = 8025
ErrNotImplemented = 8026
ErrInfoSchemaExpired = 8027
ErrInfoSchemaChanged = 8028
ErrBadNumber = 8029
ErrCastAsSignedOverflow = 8030
ErrCastNegIntAsUnsigned = 8031
ErrInvalidYearFormat = 8032
ErrInvalidYear = 8033
ErrIncorrectDatetimeValue = 8034
ErrInvalidTimeFormat = 8036
ErrInvalidWeekModeFormat = 8037
ErrFieldGetDefaultFailed = 8038
ErrIndexOutBound = 8039
ErrUnsupportedOp = 8040
ErrRowNotFound = 8041
ErrTableStateCantNone = 8042
ErrColumnStateNonPublic = 8043
ErrIndexStateCantNone = 8044
ErrInvalidRecordKey = 8045
ErrColumnStateCantNone = 8046
ErrUnsupportedValueForVar = 8047
ErrUnsupportedIsolationLevel = 8048
ErrLoadPrivilege = 8049
ErrInvalidPrivilegeType = 8050
ErrUnknownFieldType = 8051
ErrInvalidSequence = 8052
ErrCantGetValidID = 8053
ErrCantSetToNull = 8054
ErrSnapshotTooOld = 8055
ErrInvalidTableID = 8056
ErrInvalidType = 8057
ErrUnknownAllocatorType = 8058
ErrAutoRandReadFailed = 8059
ErrInvalidIncrementAndOffset = 8060
ErrWarnOptimizerHintUnsupportedHint = 8061
ErrWarnOptimizerHintInvalidToken = 8062
ErrWarnMemoryQuotaOverflow = 8063
ErrWarnOptimizerHintParseError = 8064
ErrWarnOptimizerHintInvalidInteger = 8065
ErrUnsupportedSecondArgumentType = 8066
ErrInvalidPluginID = 8101
ErrInvalidPluginManifest = 8102
ErrInvalidPluginName = 8103
ErrInvalidPluginVersion = 8104
ErrDuplicatePlugin = 8105
ErrInvalidPluginSysVarName = 8106
ErrRequireVersionCheckFail = 8107
ErrUnsupportedType = 8108
ErrAnalyzeMissIndex = 8109
ErrCartesianProductUnsupported = 8110
ErrPreparedStmtNotFound = 8111
ErrWrongParamCount = 8112
ErrSchemaChanged = 8113
ErrUnknownPlan = 8114
ErrPrepareMulti = 8115
ErrPrepareDDL = 8116
ErrResultIsEmpty = 8117
ErrBuildExecutor = 8118
ErrBatchInsertFail = 8119
ErrGetStartTS = 8120
ErrPrivilegeCheckFail = 8121
ErrInvalidWildCard = 8122
ErrBRIEBackupFailed = 8124
ErrBRIERestoreFailed = 8125
ErrBRIEImportFailed = 8126
ErrBRIEExportFailed = 8127
ErrInvalidTableSample = 8128
ErrJSONObjectKeyTooLong = 8129
ErrMultiStatementDisabled = 8130
ErrMemExceedThreshold = 8001
ErrForUpdateCantRetry = 8002
ErrAdminCheckTable = 8003
ErrTxnTooLarge = 8004
ErrWriteConflictInTiDB = 8005
ErrUnsupportedReloadPlugin = 8018
ErrUnsupportedReloadPluginVar = 8019
ErrTableLocked = 8020
ErrNotExist = 8021
ErrTxnRetryable = 8022
ErrCannotSetNilValue = 8023
ErrInvalidTxn = 8024
ErrEntryTooLarge = 8025
ErrNotImplemented = 8026
ErrInfoSchemaExpired = 8027
ErrInfoSchemaChanged = 8028
ErrBadNumber = 8029
ErrCastAsSignedOverflow = 8030
ErrCastNegIntAsUnsigned = 8031
ErrInvalidYearFormat = 8032
ErrInvalidYear = 8033
ErrIncorrectDatetimeValue = 8034
ErrInvalidTimeFormat = 8036
ErrInvalidWeekModeFormat = 8037
ErrFieldGetDefaultFailed = 8038
ErrIndexOutBound = 8039
ErrUnsupportedOp = 8040
ErrRowNotFound = 8041
ErrTableStateCantNone = 8042
ErrColumnStateNonPublic = 8043
ErrIndexStateCantNone = 8044
ErrInvalidRecordKey = 8045
ErrColumnStateCantNone = 8046
ErrUnsupportedValueForVar = 8047
ErrUnsupportedIsolationLevel = 8048
ErrLoadPrivilege = 8049
ErrInvalidPrivilegeType = 8050
ErrUnknownFieldType = 8051
ErrInvalidSequence = 8052
ErrCantGetValidID = 8053
ErrCantSetToNull = 8054
ErrSnapshotTooOld = 8055
ErrInvalidTableID = 8056
ErrInvalidType = 8057
ErrUnknownAllocatorType = 8058
ErrAutoRandReadFailed = 8059
ErrInvalidIncrementAndOffset = 8060
ErrWarnOptimizerHintUnsupportedHint = 8061
ErrWarnOptimizerHintInvalidToken = 8062
ErrWarnMemoryQuotaOverflow = 8063
ErrWarnOptimizerHintParseError = 8064
ErrWarnOptimizerHintInvalidInteger = 8065
ErrUnsupportedSecondArgumentType = 8066
ErrInvalidPluginID = 8101
ErrInvalidPluginManifest = 8102
ErrInvalidPluginName = 8103
ErrInvalidPluginVersion = 8104
ErrDuplicatePlugin = 8105
ErrInvalidPluginSysVarName = 8106
ErrRequireVersionCheckFail = 8107
ErrUnsupportedType = 8108
ErrAnalyzeMissIndex = 8109
ErrCartesianProductUnsupported = 8110
ErrPreparedStmtNotFound = 8111
ErrWrongParamCount = 8112
ErrSchemaChanged = 8113
ErrUnknownPlan = 8114
ErrPrepareMulti = 8115
ErrPrepareDDL = 8116
ErrResultIsEmpty = 8117
ErrBuildExecutor = 8118
ErrBatchInsertFail = 8119
ErrGetStartTS = 8120
ErrPrivilegeCheckFail = 8121
ErrInvalidWildCard = 8122
ErrBRIEBackupFailed = 8124
ErrBRIERestoreFailed = 8125
ErrBRIEImportFailed = 8126
ErrBRIEExportFailed = 8127
ErrInvalidTableSample = 8128
ErrJSONObjectKeyTooLong = 8129
ErrMultiStatementDisabled = 8130

// Error codes used by TiDB ddl package
ErrUnsupportedDDLOperation = 8200
Expand Down
44 changes: 22 additions & 22 deletions errno/errname.go
Original file line number Diff line number Diff line change
Expand Up @@ -1001,28 +1001,28 @@ var MySQLErrName = map[uint16]*mysql.ErrMessage{
ErrWarnMemoryQuotaOverflow: mysql.Message("Max value of MEMORY_QUOTA is %d bytes, ignore this invalid limit", nil),
ErrWarnOptimizerHintParseError: mysql.Message("Optimizer hint syntax error at %v", nil),

ErrSequenceUnsupportedTableOption: mysql.Message("Unsupported sequence table-option %s", nil),
ErrColumnTypeUnsupportedNextValue: mysql.Message("Unsupported sequence default value for column type '%s'", nil),
ErrAddColumnWithSequenceAsDefault: mysql.Message("Unsupported using sequence as default value in add column '%s'", nil),
ErrUnsupportedType: mysql.Message("Unsupported type %T", nil),
ErrAnalyzeMissIndex: mysql.Message("Index '%s' in field list does not exist in table '%s'", nil),
ErrCartesianProductUnsupported: mysql.Message("Cartesian product is unsupported", nil),
ErrPreparedStmtNotFound: mysql.Message("Prepared statement not found", nil),
ErrWrongParamCount: mysql.Message("Wrong parameter count", nil),
ErrSchemaChanged: mysql.Message("Schema has changed", nil),
ErrUnknownPlan: mysql.Message("Unknown plan", nil),
ErrPrepareMulti: mysql.Message("Can not prepare multiple statements", nil),
ErrPrepareDDL: mysql.Message("Can not prepare DDL statements with parameters", nil),
ErrResultIsEmpty: mysql.Message("Result is empty", nil),
ErrBuildExecutor: mysql.Message("Failed to build executor", nil),
ErrBatchInsertFail: mysql.Message("Batch insert failed, please clean the table and try again.", nil),
ErrGetStartTS: mysql.Message("Can not get start ts", nil),
ErrPrivilegeCheckFail: mysql.Message("privilege check fail", nil), // this error message should begin lowercased to be compatible with the test
ErrInvalidWildCard: mysql.Message("Wildcard fields without any table name appears in wrong place", nil),
ErrUnsupportedSecondArgumentType: mysql.Message("JSON_OBJECTAGG: unsupported second argument type %v", nil),
ErrLockExpire: mysql.Message("TTL manager has timed out, pessimistic locks may expire, please commit or rollback this transaction", nil),
ErrTableOptionUnionUnsupported: mysql.Message("CREATE/ALTER table with union option is not supported", nil),
ErrTableOptionInsertMethodUnsupported: mysql.Message("CREATE/ALTER table with insert method option is not supported", nil),
ErrSequenceUnsupportedTableOption: mysql.Message("Unsupported sequence table-option %s", nil),
ErrColumnTypeUnsupportedNextValue: mysql.Message("Unsupported sequence default value for column type '%s'", nil),
ErrAddColumnWithSequenceAsDefault: mysql.Message("Unsupported using sequence as default value in add column '%s'", nil),
ErrUnsupportedType: mysql.Message("Unsupported type %T", nil),
ErrAnalyzeMissIndex: mysql.Message("Index '%s' in field list does not exist in table '%s'", nil),
ErrCartesianProductUnsupported: mysql.Message("Cartesian product is unsupported", nil),
ErrPreparedStmtNotFound: mysql.Message("Prepared statement not found", nil),
ErrWrongParamCount: mysql.Message("Wrong parameter count", nil),
ErrSchemaChanged: mysql.Message("Schema has changed", nil),
ErrUnknownPlan: mysql.Message("Unknown plan", nil),
ErrPrepareMulti: mysql.Message("Can not prepare multiple statements", nil),
ErrPrepareDDL: mysql.Message("Can not prepare DDL statements with parameters", nil),
ErrResultIsEmpty: mysql.Message("Result is empty", nil),
ErrBuildExecutor: mysql.Message("Failed to build executor", nil),
ErrBatchInsertFail: mysql.Message("Batch insert failed, please clean the table and try again.", nil),
ErrGetStartTS: mysql.Message("Can not get start ts", nil),
ErrPrivilegeCheckFail: mysql.Message("privilege check fail", nil), // this error message should begin lowercased to be compatible with the test
ErrInvalidWildCard: mysql.Message("Wildcard fields without any table name appears in wrong place", nil),
ErrUnsupportedSecondArgumentType: mysql.Message("JSON_OBJECTAGG: unsupported second argument type %v", nil),
ErrLockExpire: mysql.Message("TTL manager has timed out, pessimistic locks may expire, please commit or rollback this transaction", nil),
ErrTableOptionUnionUnsupported: mysql.Message("CREATE/ALTER table with union option is not supported", nil),
ErrTableOptionInsertMethodUnsupported: mysql.Message("CREATE/ALTER table with insert method option is not supported", nil),

ErrBRIEBackupFailed: mysql.Message("Backup failed: %s", nil),
ErrBRIERestoreFailed: mysql.Message("Restore failed: %s", nil),
Expand Down
2 changes: 1 addition & 1 deletion errors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ error = '''
Wildcard fields without any table name appears in wrong place
'''

["planner:8123"]
["planner:1140"]
error = '''
In aggregated query without GROUP BY, expression #%d of SELECT list contains nonaggregated column '%s'; this is incompatible with sql_mode=only_full_group_by
'''
Expand Down
20 changes: 10 additions & 10 deletions planner/core/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package core_test
import (
"bytes"
"fmt"
"github.com/pingcap/tidb/errno"
"strings"

. "github.com/pingcap/check"
Expand All @@ -26,6 +25,7 @@ import (
"github.com/pingcap/parser/terror"
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/domain"
"github.com/pingcap/tidb/errno"
"github.com/pingcap/tidb/expression"
"github.com/pingcap/tidb/infoschema"
"github.com/pingcap/tidb/kv"
Expand Down Expand Up @@ -2105,7 +2105,7 @@ func (s *testIntegrationSuite) TestOrderByHavingNotInSelect(c *C) {
tk.MustGetErrMsg("select v1 from ttest order by count(v2)",
"[planner:3029]Expression #1 of ORDER BY contains aggregate function and applies to the result of a non-aggregated query")
tk.MustGetErrMsg("select v1 from ttest having count(v2)",
"[planner:8123]In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'v1'; this is incompatible with sql_mode=only_full_group_by")
"[planner:1140]In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'v1'; this is incompatible with sql_mode=only_full_group_by")
}

func (s *testIntegrationSuite) TestUpdateSetDefault(c *C) {
Expand Down Expand Up @@ -2628,13 +2628,13 @@ func (s *testIntegrationSerialSuite) TestMppAggWithJoin(c *C) {
func (s *testIntegrationSuite) TestIssue22694(c *C) {
tk := testkit.NewTestKitWithInit(c, s.store)
tk.MustExec("drop table if exists table_5_utf8_6")
tk.MustExec("create table table_5_utf8_6 (" +
"`pk` int primary key," +
"`col_double_key_signed` double ," +
"key (`col_double_key_signed`)" +
") character set utf8" +
"partition by hash(pk)" +
tk.MustExec("create table table_5_utf8_6 (\n" +
"`pk` int primary key,\n" +
"`col_double_key_signed` double,\n" +
"key (`col_double_key_signed`)\n" +
") character set utf8\n" +
"partition by hash(pk)\n" +
"partitions 6")
err := tk.ExecToErr("SELECT ALL `col_double_key_signed` FROM table_5_utf8_6 HAVING ( CAST( ( COUNT( BINARY -3688098003402515037 ) ) AS TIME ) ) FOR UPDATE");
c.Assert(int(terror.ToSQLError(errors.Cause(err).(*terror.Error)).Code), Equals, mysql.ErrMixOfGroupFuncAndFields)
err := tk.ExecToErr("SELECT ALL `col_double_key_signed` FROM table_5_utf8_6 HAVING ( CAST( ( COUNT( BINARY -3688098003402515037 ) ) AS TIME ) ) FOR UPDATE")
c.Assert(int(terror.ToSQLError(errors.Cause(err).(*terror.Error)).Code), Equals, errno.ErrMixOfGroupFuncAndFields)
}

0 comments on commit adb7015

Please sign in to comment.