From d3984fb6839cc89f702e5a86fa249e843c0655ae Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Wed, 11 Mar 2020 11:37:25 +0800 Subject: [PATCH 1/6] errno: move the error code from the parser/mysql to tidb/errno --- ddl/ddl.go | 177 ------ ddl/error.go | 198 ++++++ domain/domain.go | 8 +- errno/errcode.go | 1081 ++++++++++++++++++++++++++++++++ errno/errname.go | 1078 +++++++++++++++++++++++++++++++ executor/errors.go | 2 +- go.mod | 2 + go.sum | 6 + infoschema/error.go | 70 +++ infoschema/infoschema.go | 52 -- kv/error.go | 2 +- meta/autoid/errors.go | 2 +- planner/core/errors.go | 2 +- plugin/errors.go | 16 +- privilege/privileges/errors.go | 2 +- server/server.go | 13 +- session/tidb.go | 5 +- sessionctx/variable/error.go | 37 ++ sessionctx/variable/session.go | 8 - sessionctx/variable/sysvar.go | 15 - store/tikv/error.go | 2 +- structure/structure.go | 2 +- table/table.go | 2 +- tablecodec/tablecodec.go | 7 +- types/errors.go | 2 +- types/json/constants.go | 2 +- util/admin/admin.go | 9 +- util/memory/action.go | 4 +- util/ranger/points.go | 3 +- 29 files changed, 2516 insertions(+), 293 deletions(-) create mode 100644 ddl/error.go create mode 100644 errno/errcode.go create mode 100644 errno/errname.go create mode 100644 infoschema/error.go create mode 100644 sessionctx/variable/error.go diff --git a/ddl/ddl.go b/ddl/ddl.go index 7bd10929505e0..31b55af1033fc 100644 --- a/ddl/ddl.go +++ b/ddl/ddl.go @@ -74,183 +74,6 @@ var ( EnableSplitTableRegion = uint32(0) ) -var ( - // errWorkerClosed means we have already closed the DDL worker. - errInvalidWorker = terror.ClassDDL.New(mysql.ErrInvalidDDLWorker, mysql.MySQLErrName[mysql.ErrInvalidDDLWorker]) - // errNotOwner means we are not owner and can't handle DDL jobs. - errNotOwner = terror.ClassDDL.New(mysql.ErrNotOwner, mysql.MySQLErrName[mysql.ErrNotOwner]) - errCantDecodeIndex = terror.ClassDDL.New(mysql.ErrCantDecodeIndex, mysql.MySQLErrName[mysql.ErrCantDecodeIndex]) - errInvalidDDLJob = terror.ClassDDL.New(mysql.ErrInvalidDDLJob, mysql.MySQLErrName[mysql.ErrInvalidDDLJob]) - errCancelledDDLJob = terror.ClassDDL.New(mysql.ErrCancelledDDLJob, mysql.MySQLErrName[mysql.ErrCancelledDDLJob]) - errFileNotFound = terror.ClassDDL.New(mysql.ErrFileNotFound, mysql.MySQLErrName[mysql.ErrFileNotFound]) - errRunMultiSchemaChanges = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "multi schema change")) - errWaitReorgTimeout = terror.ClassDDL.New(mysql.ErrLockWaitTimeout, mysql.MySQLErrName[mysql.ErrWaitReorgTimeout]) - errInvalidStoreVer = terror.ClassDDL.New(mysql.ErrInvalidStoreVersion, mysql.MySQLErrName[mysql.ErrInvalidStoreVersion]) - // ErrRepairTableFail is used to repair tableInfo in repair mode. - ErrRepairTableFail = terror.ClassDDL.New(mysql.ErrRepairTable, mysql.MySQLErrName[mysql.ErrRepairTable]) - - // We don't support dropping column with index covered now. - errCantDropColWithIndex = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "drop column with index")) - errUnsupportedAddColumn = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "add column")) - errUnsupportedModifyColumn = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "modify column: %s")) - errUnsupportedModifyCharset = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "modify %s")) - errUnsupportedPKHandle = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "drop integer primary key")) - errUnsupportedCharset = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "charset %s and collate %s")) - errUnsupportedShardRowIDBits = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "shard_row_id_bits for table with primary key as row id")) - errBlobKeyWithoutLength = terror.ClassDDL.New(mysql.ErrBlobKeyWithoutLength, mysql.MySQLErrName[mysql.ErrBlobKeyWithoutLength]) - errKeyPart0 = terror.ClassDDL.New(mysql.ErrKeyPart0, mysql.MySQLErrName[mysql.ErrKeyPart0]) - errIncorrectPrefixKey = terror.ClassDDL.New(mysql.ErrWrongSubKey, mysql.MySQLErrName[mysql.ErrWrongSubKey]) - errTooLongKey = terror.ClassDDL.New(mysql.ErrTooLongKey, mysql.MySQLErrName[mysql.ErrTooLongKey]) - errKeyColumnDoesNotExits = terror.ClassDDL.New(mysql.ErrKeyColumnDoesNotExits, mysql.MySQLErrName[mysql.ErrKeyColumnDoesNotExits]) - errUnknownTypeLength = terror.ClassDDL.New(mysql.ErrUnknownTypeLength, mysql.MySQLErrName[mysql.ErrUnknownTypeLength]) - errUnknownFractionLength = terror.ClassDDL.New(mysql.ErrUnknownFractionLength, mysql.MySQLErrName[mysql.ErrUnknownFractionLength]) - errInvalidDDLJobVersion = terror.ClassDDL.New(mysql.ErrInvalidDDLJobVersion, mysql.MySQLErrName[mysql.ErrInvalidDDLJobVersion]) - errInvalidUseOfNull = terror.ClassDDL.New(mysql.ErrInvalidUseOfNull, mysql.MySQLErrName[mysql.ErrInvalidUseOfNull]) - errTooManyFields = terror.ClassDDL.New(mysql.ErrTooManyFields, mysql.MySQLErrName[mysql.ErrTooManyFields]) - errInvalidSplitRegionRanges = terror.ClassDDL.New(mysql.ErrInvalidSplitRegionRanges, mysql.MySQLErrName[mysql.ErrInvalidSplitRegionRanges]) - errReorgPanic = terror.ClassDDL.New(mysql.ErrReorgPanic, mysql.MySQLErrName[mysql.ErrReorgPanic]) - errFkColumnCannotDrop = terror.ClassDDL.New(mysql.ErrFkColumnCannotDrop, mysql.MySQLErrName[mysql.ErrFkColumnCannotDrop]) - errFKIncompatibleColumns = terror.ClassDDL.New(mysql.ErrFKIncompatibleColumns, mysql.MySQLErrName[mysql.ErrFKIncompatibleColumns]) - - errOnlyOnRangeListPartition = terror.ClassDDL.New(mysql.ErrOnlyOnRangeListPartition, mysql.MySQLErrName[mysql.ErrOnlyOnRangeListPartition]) - // errWrongKeyColumn is for table column cannot be indexed. - errWrongKeyColumn = terror.ClassDDL.New(mysql.ErrWrongKeyColumn, mysql.MySQLErrName[mysql.ErrWrongKeyColumn]) - // errWrongFKOptionForGeneratedColumn is for wrong foreign key reference option on generated columns. - errWrongFKOptionForGeneratedColumn = terror.ClassDDL.New(mysql.ErrWrongFKOptionForGeneratedColumn, mysql.MySQLErrName[mysql.ErrWrongFKOptionForGeneratedColumn]) - // errUnsupportedOnGeneratedColumn is for unsupported actions on generated columns. - errUnsupportedOnGeneratedColumn = terror.ClassDDL.New(mysql.ErrUnsupportedOnGeneratedColumn, mysql.MySQLErrName[mysql.ErrUnsupportedOnGeneratedColumn]) - // errGeneratedColumnNonPrior forbids to refer generated column non prior to it. - errGeneratedColumnNonPrior = terror.ClassDDL.New(mysql.ErrGeneratedColumnNonPrior, mysql.MySQLErrName[mysql.ErrGeneratedColumnNonPrior]) - // errDependentByGeneratedColumn forbids to delete columns which are dependent by generated columns. - errDependentByGeneratedColumn = terror.ClassDDL.New(mysql.ErrDependentByGeneratedColumn, mysql.MySQLErrName[mysql.ErrDependentByGeneratedColumn]) - // errJSONUsedAsKey forbids to use JSON as key or index. - errJSONUsedAsKey = terror.ClassDDL.New(mysql.ErrJSONUsedAsKey, mysql.MySQLErrName[mysql.ErrJSONUsedAsKey]) - // errBlobCantHaveDefault forbids to give not null default value to TEXT/BLOB/JSON. - errBlobCantHaveDefault = terror.ClassDDL.New(mysql.ErrBlobCantHaveDefault, mysql.MySQLErrName[mysql.ErrBlobCantHaveDefault]) - errTooLongIndexComment = terror.ClassDDL.New(mysql.ErrTooLongIndexComment, mysql.MySQLErrName[mysql.ErrTooLongIndexComment]) - // ErrInvalidDefaultValue returns for invalid default value for columns. - ErrInvalidDefaultValue = terror.ClassDDL.New(mysql.ErrInvalidDefault, mysql.MySQLErrName[mysql.ErrInvalidDefault]) - // ErrGeneratedColumnRefAutoInc forbids to refer generated columns to auto-increment columns . - ErrGeneratedColumnRefAutoInc = terror.ClassDDL.New(mysql.ErrGeneratedColumnRefAutoInc, mysql.MySQLErrName[mysql.ErrGeneratedColumnRefAutoInc]) - // ErrUnsupportedAddPartition returns for does not support add partitions. - ErrUnsupportedAddPartition = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "add partitions")) - // ErrUnsupportedCoalescePartition returns for does not support coalesce partitions. - ErrUnsupportedCoalescePartition = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "coalesce partitions")) - // ErrGeneratedColumnFunctionIsNotAllowed returns for unsupported functions for generated columns. - ErrGeneratedColumnFunctionIsNotAllowed = terror.ClassDDL.New(mysql.ErrGeneratedColumnFunctionIsNotAllowed, mysql.MySQLErrName[mysql.ErrGeneratedColumnFunctionIsNotAllowed]) - // ErrUnsupportedPartitionByRangeColumns returns for does unsupported partition by range columns. - ErrUnsupportedPartitionByRangeColumns = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "partition by range columns")) - errUnsupportedCreatePartition = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "partition type, treat as normal table")) - errTablePartitionDisabled = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, "Partitions are ignored because Table Partition is disabled, please set 'tidb_enable_table_partition' if you need to need to enable it") - errUnsupportedIndexType = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "index type")) - - // ErrDupKeyName returns for duplicated key name - ErrDupKeyName = terror.ClassDDL.New(mysql.ErrDupKeyName, mysql.MySQLErrName[mysql.ErrDupKeyName]) - // ErrInvalidDDLState returns for invalid ddl model object state. - ErrInvalidDDLState = terror.ClassDDL.New(mysql.ErrInvalidDDLState, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrInvalidDDLState])) - // ErrUnsupportedModifyPrimaryKey returns an error when add or drop the primary key. - // It's exported for testing. - ErrUnsupportedModifyPrimaryKey = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "%s primary key")) - - // ErrColumnBadNull returns for a bad null value. - ErrColumnBadNull = terror.ClassDDL.New(mysql.ErrBadNull, mysql.MySQLErrName[mysql.ErrBadNull]) - // ErrBadField forbids to refer to unknown column. - ErrBadField = terror.ClassDDL.New(mysql.ErrBadField, mysql.MySQLErrName[mysql.ErrBadField]) - // ErrCantRemoveAllFields returns for deleting all columns. - ErrCantRemoveAllFields = terror.ClassDDL.New(mysql.ErrCantRemoveAllFields, mysql.MySQLErrName[mysql.ErrCantRemoveAllFields]) - // ErrCantDropFieldOrKey returns for dropping a non-existent field or key. - ErrCantDropFieldOrKey = terror.ClassDDL.New(mysql.ErrCantDropFieldOrKey, mysql.MySQLErrName[mysql.ErrCantDropFieldOrKey]) - // ErrInvalidOnUpdate returns for invalid ON UPDATE clause. - ErrInvalidOnUpdate = terror.ClassDDL.New(mysql.ErrInvalidOnUpdate, mysql.MySQLErrName[mysql.ErrInvalidOnUpdate]) - // ErrTooLongIdent returns for too long name of database/table/column/index. - ErrTooLongIdent = terror.ClassDDL.New(mysql.ErrTooLongIdent, mysql.MySQLErrName[mysql.ErrTooLongIdent]) - // ErrWrongDBName returns for wrong database name. - ErrWrongDBName = terror.ClassDDL.New(mysql.ErrWrongDBName, mysql.MySQLErrName[mysql.ErrWrongDBName]) - // ErrWrongTableName returns for wrong table name. - ErrWrongTableName = terror.ClassDDL.New(mysql.ErrWrongTableName, mysql.MySQLErrName[mysql.ErrWrongTableName]) - // ErrWrongColumnName returns for wrong column name. - ErrWrongColumnName = terror.ClassDDL.New(mysql.ErrWrongColumnName, mysql.MySQLErrName[mysql.ErrWrongColumnName]) - // ErrInvalidGroupFuncUse returns for using invalid group functions. - ErrInvalidGroupFuncUse = terror.ClassDDL.New(mysql.ErrInvalidGroupFuncUse, mysql.MySQLErrName[mysql.ErrInvalidGroupFuncUse]) - // ErrTableMustHaveColumns returns for missing column when creating a table. - ErrTableMustHaveColumns = terror.ClassDDL.New(mysql.ErrTableMustHaveColumns, mysql.MySQLErrName[mysql.ErrTableMustHaveColumns]) - // ErrWrongNameForIndex returns for wrong index name. - ErrWrongNameForIndex = terror.ClassDDL.New(mysql.ErrWrongNameForIndex, mysql.MySQLErrName[mysql.ErrWrongNameForIndex]) - // ErrUnknownCharacterSet returns unknown character set. - ErrUnknownCharacterSet = terror.ClassDDL.New(mysql.ErrUnknownCharacterSet, mysql.MySQLErrName[mysql.ErrUnknownCharacterSet]) - // ErrUnknownCollation returns unknown collation. - ErrUnknownCollation = terror.ClassDDL.New(mysql.ErrUnknownCollation, mysql.MySQLErrName[mysql.ErrUnknownCollation]) - // ErrCollationCharsetMismatch returns when collation not match the charset. - ErrCollationCharsetMismatch = terror.ClassDDL.New(mysql.ErrCollationCharsetMismatch, mysql.MySQLErrName[mysql.ErrCollationCharsetMismatch]) - // ErrConflictingDeclarations return conflict declarations. - ErrConflictingDeclarations = terror.ClassDDL.New(mysql.ErrConflictingDeclarations, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrConflictingDeclarations], "CHARACTER SET ", "%s", "CHARACTER SET ", "%s")) - // ErrPrimaryCantHaveNull returns All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead - ErrPrimaryCantHaveNull = terror.ClassDDL.New(mysql.ErrPrimaryCantHaveNull, mysql.MySQLErrName[mysql.ErrPrimaryCantHaveNull]) - // ErrErrorOnRename returns error for wrong database name in alter table rename - ErrErrorOnRename = terror.ClassDDL.New(mysql.ErrErrorOnRename, mysql.MySQLErrName[mysql.ErrErrorOnRename]) - - // ErrNotAllowedTypeInPartition returns not allowed type error when creating table partition with unsupported expression type. - ErrNotAllowedTypeInPartition = terror.ClassDDL.New(mysql.ErrFieldTypeNotAllowedAsPartitionField, mysql.MySQLErrName[mysql.ErrFieldTypeNotAllowedAsPartitionField]) - // ErrPartitionMgmtOnNonpartitioned returns it's not a partition table. - ErrPartitionMgmtOnNonpartitioned = terror.ClassDDL.New(mysql.ErrPartitionMgmtOnNonpartitioned, mysql.MySQLErrName[mysql.ErrPartitionMgmtOnNonpartitioned]) - // ErrDropPartitionNonExistent returns error in list of partition. - ErrDropPartitionNonExistent = terror.ClassDDL.New(mysql.ErrDropPartitionNonExistent, mysql.MySQLErrName[mysql.ErrDropPartitionNonExistent]) - // ErrSameNamePartition returns duplicate partition name. - ErrSameNamePartition = terror.ClassDDL.New(mysql.ErrSameNamePartition, mysql.MySQLErrName[mysql.ErrSameNamePartition]) - // ErrRangeNotIncreasing returns values less than value must be strictly increasing for each partition. - ErrRangeNotIncreasing = terror.ClassDDL.New(mysql.ErrRangeNotIncreasing, mysql.MySQLErrName[mysql.ErrRangeNotIncreasing]) - // ErrPartitionMaxvalue returns maxvalue can only be used in last partition definition. - ErrPartitionMaxvalue = terror.ClassDDL.New(mysql.ErrPartitionMaxvalue, mysql.MySQLErrName[mysql.ErrPartitionMaxvalue]) - //ErrDropLastPartition returns cannot remove all partitions, use drop table instead. - ErrDropLastPartition = terror.ClassDDL.New(mysql.ErrDropLastPartition, mysql.MySQLErrName[mysql.ErrDropLastPartition]) - //ErrTooManyPartitions returns too many partitions were defined. - ErrTooManyPartitions = terror.ClassDDL.New(mysql.ErrTooManyPartitions, mysql.MySQLErrName[mysql.ErrTooManyPartitions]) - //ErrPartitionFunctionIsNotAllowed returns this partition function is not allowed. - ErrPartitionFunctionIsNotAllowed = terror.ClassDDL.New(mysql.ErrPartitionFunctionIsNotAllowed, mysql.MySQLErrName[mysql.ErrPartitionFunctionIsNotAllowed]) - // ErrPartitionFuncNotAllowed returns partition function returns the wrong type. - ErrPartitionFuncNotAllowed = terror.ClassDDL.New(mysql.ErrPartitionFuncNotAllowed, mysql.MySQLErrName[mysql.ErrPartitionFuncNotAllowed]) - // ErrUniqueKeyNeedAllFieldsInPf returns must include all columns in the table's partitioning function. - ErrUniqueKeyNeedAllFieldsInPf = terror.ClassDDL.New(mysql.ErrUniqueKeyNeedAllFieldsInPf, mysql.MySQLErrName[mysql.ErrUniqueKeyNeedAllFieldsInPf]) - errWrongExprInPartitionFunc = terror.ClassDDL.New(mysql.ErrWrongExprInPartitionFunc, mysql.MySQLErrName[mysql.ErrWrongExprInPartitionFunc]) - // ErrWarnDataTruncated returns data truncated error. - ErrWarnDataTruncated = terror.ClassDDL.New(mysql.WarnDataTruncated, mysql.MySQLErrName[mysql.WarnDataTruncated]) - // ErrCoalesceOnlyOnHashPartition returns coalesce partition can only be used on hash/key partitions. - ErrCoalesceOnlyOnHashPartition = terror.ClassDDL.New(mysql.ErrCoalesceOnlyOnHashPartition, mysql.MySQLErrName[mysql.ErrCoalesceOnlyOnHashPartition]) - // ErrViewWrongList returns create view must include all columns in the select clause - ErrViewWrongList = terror.ClassDDL.New(mysql.ErrViewWrongList, mysql.MySQLErrName[mysql.ErrViewWrongList]) - // ErrAlterOperationNotSupported returns when alter operations is not supported. - ErrAlterOperationNotSupported = terror.ClassDDL.New(mysql.ErrAlterOperationNotSupportedReason, mysql.MySQLErrName[mysql.ErrAlterOperationNotSupportedReason]) - // ErrWrongObject returns for wrong object. - ErrWrongObject = terror.ClassDDL.New(mysql.ErrWrongObject, mysql.MySQLErrName[mysql.ErrWrongObject]) - // ErrTableCantHandleFt returns FULLTEXT keys are not supported by table type - ErrTableCantHandleFt = terror.ClassDDL.New(mysql.ErrTableCantHandleFt, mysql.MySQLErrName[mysql.ErrTableCantHandleFt]) - // ErrFieldNotFoundPart returns an error when 'partition by columns' are not found in table columns. - ErrFieldNotFoundPart = terror.ClassDDL.New(mysql.ErrFieldNotFoundPart, mysql.MySQLErrName[mysql.ErrFieldNotFoundPart]) - // ErrWrongTypeColumnValue returns 'Partition column values of incorrect type' - ErrWrongTypeColumnValue = terror.ClassDDL.New(mysql.ErrWrongTypeColumnValue, mysql.MySQLErrName[mysql.ErrWrongTypeColumnValue]) - // ErrFunctionalIndexPrimaryKey returns 'The primary key cannot be a functional index' - ErrFunctionalIndexPrimaryKey = terror.ClassDDL.New(mysql.ErrFunctionalIndexPrimaryKey, mysql.MySQLErrName[mysql.ErrFunctionalIndexPrimaryKey]) - // ErrFunctionalIndexOnField returns 'Functional index on a column is not supported. Consider using a regular index instead' - ErrFunctionalIndexOnField = terror.ClassDDL.New(mysql.ErrFunctionalIndexOnField, mysql.MySQLErrName[mysql.ErrFunctionalIndexOnField]) - // ErrInvalidAutoRandom returns when auto_random is used incorrectly. - ErrInvalidAutoRandom = terror.ClassDDL.New(mysql.ErrInvalidAutoRandom, mysql.MySQLErrName[mysql.ErrInvalidAutoRandom]) - - // ErrSequenceRunOut returns when the sequence has been run out. - ErrSequenceRunOut = terror.ClassDDL.New(mysql.ErrSequenceRunOut, mysql.MySQLErrName[mysql.ErrSequenceRunOut]) - // ErrSequenceInvalidData returns when sequence values are conflicting. - ErrSequenceInvalidData = terror.ClassDDL.New(mysql.ErrSequenceInvalidData, mysql.MySQLErrName[mysql.ErrSequenceInvalidData]) - // ErrSequenceAccessFail returns when sequences are not able to access. - ErrSequenceAccessFail = terror.ClassDDL.New(mysql.ErrSequenceAccessFail, mysql.MySQLErrName[mysql.ErrSequenceAccessFail]) - // ErrNotSequence returns when object is not a sequence. - ErrNotSequence = terror.ClassDDL.New(mysql.ErrNotSequence, mysql.MySQLErrName[mysql.ErrNotSequence]) - // ErrUnknownSequence returns when drop / alter unknown sequence. - ErrUnknownSequence = terror.ClassDDL.New(mysql.ErrUnknownSequence, mysql.MySQLErrName[mysql.ErrUnknownSequence]) - // ErrSequenceUnsupportedTableOption returns when unsupported table option exists in sequence. - ErrSequenceUnsupportedTableOption = terror.ClassDDL.New(mysql.ErrSequenceUnsupportedTableOption, mysql.MySQLErrName[mysql.ErrSequenceUnsupportedTableOption]) - // ErrColumnTypeUnsupportedNextValue is returned when sequence next value is assigned to unsupported column type. - ErrColumnTypeUnsupportedNextValue = terror.ClassDDL.New(mysql.ErrColumnTypeUnsupportedNextValue, mysql.MySQLErrName[mysql.ErrColumnTypeUnsupportedNextValue]) -) - // DDL is responsible for updating schema in data store and maintaining in-memory InfoSchema cache. type DDL interface { CreateSchema(ctx sessionctx.Context, name model.CIStr, charsetInfo *ast.CharsetOpt) error diff --git a/ddl/error.go b/ddl/error.go new file mode 100644 index 0000000000000..75924ccba7053 --- /dev/null +++ b/ddl/error.go @@ -0,0 +1,198 @@ +// Copyright 2020 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package ddl + +import ( + "fmt" + + "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" +) + +var ( + // errWorkerClosed means we have already closed the DDL worker. + errInvalidWorker = terror.ClassDDL.New(mysql.ErrInvalidDDLWorker, mysql.MySQLErrName[mysql.ErrInvalidDDLWorker]) + // errNotOwner means we are not owner and can't handle DDL jobs. + errNotOwner = terror.ClassDDL.New(mysql.ErrNotOwner, mysql.MySQLErrName[mysql.ErrNotOwner]) + errCantDecodeIndex = terror.ClassDDL.New(mysql.ErrCantDecodeIndex, mysql.MySQLErrName[mysql.ErrCantDecodeIndex]) + errInvalidDDLJob = terror.ClassDDL.New(mysql.ErrInvalidDDLJob, mysql.MySQLErrName[mysql.ErrInvalidDDLJob]) + errCancelledDDLJob = terror.ClassDDL.New(mysql.ErrCancelledDDLJob, mysql.MySQLErrName[mysql.ErrCancelledDDLJob]) + errFileNotFound = terror.ClassDDL.New(mysql.ErrFileNotFound, mysql.MySQLErrName[mysql.ErrFileNotFound]) + errRunMultiSchemaChanges = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "multi schema change")) + errWaitReorgTimeout = terror.ClassDDL.New(mysql.ErrLockWaitTimeout, mysql.MySQLErrName[mysql.ErrWaitReorgTimeout]) + errInvalidStoreVer = terror.ClassDDL.New(mysql.ErrInvalidStoreVersion, mysql.MySQLErrName[mysql.ErrInvalidStoreVersion]) + // ErrRepairTableFail is used to repair tableInfo in repair mode. + ErrRepairTableFail = terror.ClassDDL.New(mysql.ErrRepairTable, mysql.MySQLErrName[mysql.ErrRepairTable]) + + // We don't support dropping column with index covered now. + errCantDropColWithIndex = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "drop column with index")) + errUnsupportedAddColumn = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "add column")) + errUnsupportedModifyColumn = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "modify column: %s")) + errUnsupportedModifyCharset = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "modify %s")) + errUnsupportedPKHandle = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "drop integer primary key")) + errUnsupportedCharset = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "charset %s and collate %s")) + errUnsupportedShardRowIDBits = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "shard_row_id_bits for table with primary key as row id")) + errBlobKeyWithoutLength = terror.ClassDDL.New(mysql.ErrBlobKeyWithoutLength, mysql.MySQLErrName[mysql.ErrBlobKeyWithoutLength]) + errKeyPart0 = terror.ClassDDL.New(mysql.ErrKeyPart0, mysql.MySQLErrName[mysql.ErrKeyPart0]) + errIncorrectPrefixKey = terror.ClassDDL.New(mysql.ErrWrongSubKey, mysql.MySQLErrName[mysql.ErrWrongSubKey]) + errTooLongKey = terror.ClassDDL.New(mysql.ErrTooLongKey, mysql.MySQLErrName[mysql.ErrTooLongKey]) + errKeyColumnDoesNotExits = terror.ClassDDL.New(mysql.ErrKeyColumnDoesNotExits, mysql.MySQLErrName[mysql.ErrKeyColumnDoesNotExits]) + errUnknownTypeLength = terror.ClassDDL.New(mysql.ErrUnknownTypeLength, mysql.MySQLErrName[mysql.ErrUnknownTypeLength]) + errUnknownFractionLength = terror.ClassDDL.New(mysql.ErrUnknownFractionLength, mysql.MySQLErrName[mysql.ErrUnknownFractionLength]) + errInvalidDDLJobVersion = terror.ClassDDL.New(mysql.ErrInvalidDDLJobVersion, mysql.MySQLErrName[mysql.ErrInvalidDDLJobVersion]) + errInvalidUseOfNull = terror.ClassDDL.New(mysql.ErrInvalidUseOfNull, mysql.MySQLErrName[mysql.ErrInvalidUseOfNull]) + errTooManyFields = terror.ClassDDL.New(mysql.ErrTooManyFields, mysql.MySQLErrName[mysql.ErrTooManyFields]) + errInvalidSplitRegionRanges = terror.ClassDDL.New(mysql.ErrInvalidSplitRegionRanges, mysql.MySQLErrName[mysql.ErrInvalidSplitRegionRanges]) + errReorgPanic = terror.ClassDDL.New(mysql.ErrReorgPanic, mysql.MySQLErrName[mysql.ErrReorgPanic]) + errFkColumnCannotDrop = terror.ClassDDL.New(mysql.ErrFkColumnCannotDrop, mysql.MySQLErrName[mysql.ErrFkColumnCannotDrop]) + errFKIncompatibleColumns = terror.ClassDDL.New(mysql.ErrFKIncompatibleColumns, mysql.MySQLErrName[mysql.ErrFKIncompatibleColumns]) + + errOnlyOnRangeListPartition = terror.ClassDDL.New(mysql.ErrOnlyOnRangeListPartition, mysql.MySQLErrName[mysql.ErrOnlyOnRangeListPartition]) + // errWrongKeyColumn is for table column cannot be indexed. + errWrongKeyColumn = terror.ClassDDL.New(mysql.ErrWrongKeyColumn, mysql.MySQLErrName[mysql.ErrWrongKeyColumn]) + // errWrongFKOptionForGeneratedColumn is for wrong foreign key reference option on generated columns. + errWrongFKOptionForGeneratedColumn = terror.ClassDDL.New(mysql.ErrWrongFKOptionForGeneratedColumn, mysql.MySQLErrName[mysql.ErrWrongFKOptionForGeneratedColumn]) + // errUnsupportedOnGeneratedColumn is for unsupported actions on generated columns. + errUnsupportedOnGeneratedColumn = terror.ClassDDL.New(mysql.ErrUnsupportedOnGeneratedColumn, mysql.MySQLErrName[mysql.ErrUnsupportedOnGeneratedColumn]) + // errGeneratedColumnNonPrior forbids to refer generated column non prior to it. + errGeneratedColumnNonPrior = terror.ClassDDL.New(mysql.ErrGeneratedColumnNonPrior, mysql.MySQLErrName[mysql.ErrGeneratedColumnNonPrior]) + // errDependentByGeneratedColumn forbids to delete columns which are dependent by generated columns. + errDependentByGeneratedColumn = terror.ClassDDL.New(mysql.ErrDependentByGeneratedColumn, mysql.MySQLErrName[mysql.ErrDependentByGeneratedColumn]) + // errJSONUsedAsKey forbids to use JSON as key or index. + errJSONUsedAsKey = terror.ClassDDL.New(mysql.ErrJSONUsedAsKey, mysql.MySQLErrName[mysql.ErrJSONUsedAsKey]) + // errBlobCantHaveDefault forbids to give not null default value to TEXT/BLOB/JSON. + errBlobCantHaveDefault = terror.ClassDDL.New(mysql.ErrBlobCantHaveDefault, mysql.MySQLErrName[mysql.ErrBlobCantHaveDefault]) + errTooLongIndexComment = terror.ClassDDL.New(mysql.ErrTooLongIndexComment, mysql.MySQLErrName[mysql.ErrTooLongIndexComment]) + // ErrInvalidDefaultValue returns for invalid default value for columns. + ErrInvalidDefaultValue = terror.ClassDDL.New(mysql.ErrInvalidDefault, mysql.MySQLErrName[mysql.ErrInvalidDefault]) + // ErrGeneratedColumnRefAutoInc forbids to refer generated columns to auto-increment columns . + ErrGeneratedColumnRefAutoInc = terror.ClassDDL.New(mysql.ErrGeneratedColumnRefAutoInc, mysql.MySQLErrName[mysql.ErrGeneratedColumnRefAutoInc]) + // ErrUnsupportedAddPartition returns for does not support add partitions. + ErrUnsupportedAddPartition = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "add partitions")) + // ErrUnsupportedCoalescePartition returns for does not support coalesce partitions. + ErrUnsupportedCoalescePartition = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "coalesce partitions")) + // ErrGeneratedColumnFunctionIsNotAllowed returns for unsupported functions for generated columns. + ErrGeneratedColumnFunctionIsNotAllowed = terror.ClassDDL.New(mysql.ErrGeneratedColumnFunctionIsNotAllowed, mysql.MySQLErrName[mysql.ErrGeneratedColumnFunctionIsNotAllowed]) + // ErrUnsupportedPartitionByRangeColumns returns for does unsupported partition by range columns. + ErrUnsupportedPartitionByRangeColumns = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "partition by range columns")) + errUnsupportedCreatePartition = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "partition type, treat as normal table")) + errTablePartitionDisabled = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, "Partitions are ignored because Table Partition is disabled, please set 'tidb_enable_table_partition' if you need to need to enable it") + errUnsupportedIndexType = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "index type")) + + // ErrDupKeyName returns for duplicated key name + ErrDupKeyName = terror.ClassDDL.New(mysql.ErrDupKeyName, mysql.MySQLErrName[mysql.ErrDupKeyName]) + // ErrInvalidDDLState returns for invalid ddl model object state. + ErrInvalidDDLState = terror.ClassDDL.New(mysql.ErrInvalidDDLState, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrInvalidDDLState])) + // ErrUnsupportedModifyPrimaryKey returns an error when add or drop the primary key. + // It's exported for testing. + ErrUnsupportedModifyPrimaryKey = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "%s primary key")) + + // ErrColumnBadNull returns for a bad null value. + ErrColumnBadNull = terror.ClassDDL.New(mysql.ErrBadNull, mysql.MySQLErrName[mysql.ErrBadNull]) + // ErrBadField forbids to refer to unknown column. + ErrBadField = terror.ClassDDL.New(mysql.ErrBadField, mysql.MySQLErrName[mysql.ErrBadField]) + // ErrCantRemoveAllFields returns for deleting all columns. + ErrCantRemoveAllFields = terror.ClassDDL.New(mysql.ErrCantRemoveAllFields, mysql.MySQLErrName[mysql.ErrCantRemoveAllFields]) + // ErrCantDropFieldOrKey returns for dropping a non-existent field or key. + ErrCantDropFieldOrKey = terror.ClassDDL.New(mysql.ErrCantDropFieldOrKey, mysql.MySQLErrName[mysql.ErrCantDropFieldOrKey]) + // ErrInvalidOnUpdate returns for invalid ON UPDATE clause. + ErrInvalidOnUpdate = terror.ClassDDL.New(mysql.ErrInvalidOnUpdate, mysql.MySQLErrName[mysql.ErrInvalidOnUpdate]) + // ErrTooLongIdent returns for too long name of database/table/column/index. + ErrTooLongIdent = terror.ClassDDL.New(mysql.ErrTooLongIdent, mysql.MySQLErrName[mysql.ErrTooLongIdent]) + // ErrWrongDBName returns for wrong database name. + ErrWrongDBName = terror.ClassDDL.New(mysql.ErrWrongDBName, mysql.MySQLErrName[mysql.ErrWrongDBName]) + // ErrWrongTableName returns for wrong table name. + ErrWrongTableName = terror.ClassDDL.New(mysql.ErrWrongTableName, mysql.MySQLErrName[mysql.ErrWrongTableName]) + // ErrWrongColumnName returns for wrong column name. + ErrWrongColumnName = terror.ClassDDL.New(mysql.ErrWrongColumnName, mysql.MySQLErrName[mysql.ErrWrongColumnName]) + // ErrInvalidGroupFuncUse returns for using invalid group functions. + ErrInvalidGroupFuncUse = terror.ClassDDL.New(mysql.ErrInvalidGroupFuncUse, mysql.MySQLErrName[mysql.ErrInvalidGroupFuncUse]) + // ErrTableMustHaveColumns returns for missing column when creating a table. + ErrTableMustHaveColumns = terror.ClassDDL.New(mysql.ErrTableMustHaveColumns, mysql.MySQLErrName[mysql.ErrTableMustHaveColumns]) + // ErrWrongNameForIndex returns for wrong index name. + ErrWrongNameForIndex = terror.ClassDDL.New(mysql.ErrWrongNameForIndex, mysql.MySQLErrName[mysql.ErrWrongNameForIndex]) + // ErrUnknownCharacterSet returns unknown character set. + ErrUnknownCharacterSet = terror.ClassDDL.New(mysql.ErrUnknownCharacterSet, mysql.MySQLErrName[mysql.ErrUnknownCharacterSet]) + // ErrUnknownCollation returns unknown collation. + ErrUnknownCollation = terror.ClassDDL.New(mysql.ErrUnknownCollation, mysql.MySQLErrName[mysql.ErrUnknownCollation]) + // ErrCollationCharsetMismatch returns when collation not match the charset. + ErrCollationCharsetMismatch = terror.ClassDDL.New(mysql.ErrCollationCharsetMismatch, mysql.MySQLErrName[mysql.ErrCollationCharsetMismatch]) + // ErrConflictingDeclarations return conflict declarations. + ErrConflictingDeclarations = terror.ClassDDL.New(mysql.ErrConflictingDeclarations, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrConflictingDeclarations], "CHARACTER SET ", "%s", "CHARACTER SET ", "%s")) + // ErrPrimaryCantHaveNull returns All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead + ErrPrimaryCantHaveNull = terror.ClassDDL.New(mysql.ErrPrimaryCantHaveNull, mysql.MySQLErrName[mysql.ErrPrimaryCantHaveNull]) + // ErrErrorOnRename returns error for wrong database name in alter table rename + ErrErrorOnRename = terror.ClassDDL.New(mysql.ErrErrorOnRename, mysql.MySQLErrName[mysql.ErrErrorOnRename]) + + // ErrNotAllowedTypeInPartition returns not allowed type error when creating table partition with unsupported expression type. + ErrNotAllowedTypeInPartition = terror.ClassDDL.New(mysql.ErrFieldTypeNotAllowedAsPartitionField, mysql.MySQLErrName[mysql.ErrFieldTypeNotAllowedAsPartitionField]) + // ErrPartitionMgmtOnNonpartitioned returns it's not a partition table. + ErrPartitionMgmtOnNonpartitioned = terror.ClassDDL.New(mysql.ErrPartitionMgmtOnNonpartitioned, mysql.MySQLErrName[mysql.ErrPartitionMgmtOnNonpartitioned]) + // ErrDropPartitionNonExistent returns error in list of partition. + ErrDropPartitionNonExistent = terror.ClassDDL.New(mysql.ErrDropPartitionNonExistent, mysql.MySQLErrName[mysql.ErrDropPartitionNonExistent]) + // ErrSameNamePartition returns duplicate partition name. + ErrSameNamePartition = terror.ClassDDL.New(mysql.ErrSameNamePartition, mysql.MySQLErrName[mysql.ErrSameNamePartition]) + // ErrRangeNotIncreasing returns values less than value must be strictly increasing for each partition. + ErrRangeNotIncreasing = terror.ClassDDL.New(mysql.ErrRangeNotIncreasing, mysql.MySQLErrName[mysql.ErrRangeNotIncreasing]) + // ErrPartitionMaxvalue returns maxvalue can only be used in last partition definition. + ErrPartitionMaxvalue = terror.ClassDDL.New(mysql.ErrPartitionMaxvalue, mysql.MySQLErrName[mysql.ErrPartitionMaxvalue]) + //ErrDropLastPartition returns cannot remove all partitions, use drop table instead. + ErrDropLastPartition = terror.ClassDDL.New(mysql.ErrDropLastPartition, mysql.MySQLErrName[mysql.ErrDropLastPartition]) + //ErrTooManyPartitions returns too many partitions were defined. + ErrTooManyPartitions = terror.ClassDDL.New(mysql.ErrTooManyPartitions, mysql.MySQLErrName[mysql.ErrTooManyPartitions]) + //ErrPartitionFunctionIsNotAllowed returns this partition function is not allowed. + ErrPartitionFunctionIsNotAllowed = terror.ClassDDL.New(mysql.ErrPartitionFunctionIsNotAllowed, mysql.MySQLErrName[mysql.ErrPartitionFunctionIsNotAllowed]) + // ErrPartitionFuncNotAllowed returns partition function returns the wrong type. + ErrPartitionFuncNotAllowed = terror.ClassDDL.New(mysql.ErrPartitionFuncNotAllowed, mysql.MySQLErrName[mysql.ErrPartitionFuncNotAllowed]) + // ErrUniqueKeyNeedAllFieldsInPf returns must include all columns in the table's partitioning function. + ErrUniqueKeyNeedAllFieldsInPf = terror.ClassDDL.New(mysql.ErrUniqueKeyNeedAllFieldsInPf, mysql.MySQLErrName[mysql.ErrUniqueKeyNeedAllFieldsInPf]) + errWrongExprInPartitionFunc = terror.ClassDDL.New(mysql.ErrWrongExprInPartitionFunc, mysql.MySQLErrName[mysql.ErrWrongExprInPartitionFunc]) + // ErrWarnDataTruncated returns data truncated error. + ErrWarnDataTruncated = terror.ClassDDL.New(mysql.WarnDataTruncated, mysql.MySQLErrName[mysql.WarnDataTruncated]) + // ErrCoalesceOnlyOnHashPartition returns coalesce partition can only be used on hash/key partitions. + ErrCoalesceOnlyOnHashPartition = terror.ClassDDL.New(mysql.ErrCoalesceOnlyOnHashPartition, mysql.MySQLErrName[mysql.ErrCoalesceOnlyOnHashPartition]) + // ErrViewWrongList returns create view must include all columns in the select clause + ErrViewWrongList = terror.ClassDDL.New(mysql.ErrViewWrongList, mysql.MySQLErrName[mysql.ErrViewWrongList]) + // ErrAlterOperationNotSupported returns when alter operations is not supported. + ErrAlterOperationNotSupported = terror.ClassDDL.New(mysql.ErrAlterOperationNotSupportedReason, mysql.MySQLErrName[mysql.ErrAlterOperationNotSupportedReason]) + // ErrWrongObject returns for wrong object. + ErrWrongObject = terror.ClassDDL.New(mysql.ErrWrongObject, mysql.MySQLErrName[mysql.ErrWrongObject]) + // ErrTableCantHandleFt returns FULLTEXT keys are not supported by table type + ErrTableCantHandleFt = terror.ClassDDL.New(mysql.ErrTableCantHandleFt, mysql.MySQLErrName[mysql.ErrTableCantHandleFt]) + // ErrFieldNotFoundPart returns an error when 'partition by columns' are not found in table columns. + ErrFieldNotFoundPart = terror.ClassDDL.New(mysql.ErrFieldNotFoundPart, mysql.MySQLErrName[mysql.ErrFieldNotFoundPart]) + // ErrWrongTypeColumnValue returns 'Partition column values of incorrect type' + ErrWrongTypeColumnValue = terror.ClassDDL.New(mysql.ErrWrongTypeColumnValue, mysql.MySQLErrName[mysql.ErrWrongTypeColumnValue]) + // ErrFunctionalIndexPrimaryKey returns 'The primary key cannot be a functional index' + ErrFunctionalIndexPrimaryKey = terror.ClassDDL.New(mysql.ErrFunctionalIndexPrimaryKey, mysql.MySQLErrName[mysql.ErrFunctionalIndexPrimaryKey]) + // ErrFunctionalIndexOnField returns 'Functional index on a column is not supported. Consider using a regular index instead' + ErrFunctionalIndexOnField = terror.ClassDDL.New(mysql.ErrFunctionalIndexOnField, mysql.MySQLErrName[mysql.ErrFunctionalIndexOnField]) + // ErrInvalidAutoRandom returns when auto_random is used incorrectly. + ErrInvalidAutoRandom = terror.ClassDDL.New(mysql.ErrInvalidAutoRandom, mysql.MySQLErrName[mysql.ErrInvalidAutoRandom]) + + // ErrSequenceRunOut returns when the sequence has been run out. + ErrSequenceRunOut = terror.ClassDDL.New(mysql.ErrSequenceRunOut, mysql.MySQLErrName[mysql.ErrSequenceRunOut]) + // ErrSequenceInvalidData returns when sequence values are conflicting. + ErrSequenceInvalidData = terror.ClassDDL.New(mysql.ErrSequenceInvalidData, mysql.MySQLErrName[mysql.ErrSequenceInvalidData]) + // ErrSequenceAccessFail returns when sequences are not able to access. + ErrSequenceAccessFail = terror.ClassDDL.New(mysql.ErrSequenceAccessFail, mysql.MySQLErrName[mysql.ErrSequenceAccessFail]) + // ErrNotSequence returns when object is not a sequence. + ErrNotSequence = terror.ClassDDL.New(mysql.ErrNotSequence, mysql.MySQLErrName[mysql.ErrNotSequence]) + // ErrUnknownSequence returns when drop / alter unknown sequence. + ErrUnknownSequence = terror.ClassDDL.New(mysql.ErrUnknownSequence, mysql.MySQLErrName[mysql.ErrUnknownSequence]) + // ErrSequenceUnsupportedTableOption returns when unsupported table option exists in sequence. + ErrSequenceUnsupportedTableOption = terror.ClassDDL.New(mysql.ErrSequenceUnsupportedTableOption, mysql.MySQLErrName[mysql.ErrSequenceUnsupportedTableOption]) + // ErrColumnTypeUnsupportedNextValue is returned when sequence next value is assigned to unsupported column type. + ErrColumnTypeUnsupportedNextValue = terror.ClassDDL.New(mysql.ErrColumnTypeUnsupportedNextValue, mysql.MySQLErrName[mysql.ErrColumnTypeUnsupportedNextValue]) +) diff --git a/domain/domain.go b/domain/domain.go index b8567284af927..5bdcd80db03ee 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -27,12 +27,12 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/parser/ast" "github.com/pingcap/parser/model" - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/bindinfo" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/domain/infosync" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/infoschema/perfschema" "github.com/pingcap/tidb/kv" @@ -1158,8 +1158,8 @@ func recoverInDomain(funcName string, quit bool) { var ( // ErrInfoSchemaExpired returns the error that information schema is out of date. - ErrInfoSchemaExpired = terror.ClassDomain.New(mysql.ErrInfoSchemaExpired, mysql.MySQLErrName[mysql.ErrInfoSchemaExpired]) + ErrInfoSchemaExpired = terror.ClassDomain.New(errno.ErrInfoSchemaExpired, errno.MySQLErrName[errno.ErrInfoSchemaExpired]) // ErrInfoSchemaChanged returns the error that information schema is changed. - ErrInfoSchemaChanged = terror.ClassDomain.New(mysql.ErrInfoSchemaChanged, - mysql.MySQLErrName[mysql.ErrInfoSchemaChanged]+". "+kv.TxnRetryableMark) + ErrInfoSchemaChanged = terror.ClassDomain.New(errno.ErrInfoSchemaChanged, + errno.MySQLErrName[errno.ErrInfoSchemaChanged]+". "+kv.TxnRetryableMark) ) diff --git a/errno/errcode.go b/errno/errcode.go new file mode 100644 index 0000000000000..b3bfd9f2fd61f --- /dev/null +++ b/errno/errcode.go @@ -0,0 +1,1081 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package errno + +// MySQL error code. +// This value is numeric. It is not portable to other database systems. +const ( + ErrErrorFirst uint16 = 1000 + ErrHashchk = 1000 + ErrNisamchk = 1001 + ErrNo = 1002 + ErrYes = 1003 + ErrCantCreateFile = 1004 + ErrCantCreateTable = 1005 + ErrCantCreateDB = 1006 + ErrDBCreateExists = 1007 + ErrDBDropExists = 1008 + ErrDBDropDelete = 1009 + ErrDBDropRmdir = 1010 + ErrCantDeleteFile = 1011 + ErrCantFindSystemRec = 1012 + ErrCantGetStat = 1013 + ErrCantGetWd = 1014 + ErrCantLock = 1015 + ErrCantOpenFile = 1016 + ErrFileNotFound = 1017 + ErrCantReadDir = 1018 + ErrCantSetWd = 1019 + ErrCheckread = 1020 + ErrDiskFull = 1021 + ErrDupKey = 1022 + ErrErrorOnClose = 1023 + ErrErrorOnRead = 1024 + ErrErrorOnRename = 1025 + ErrErrorOnWrite = 1026 + ErrFileUsed = 1027 + ErrFilsortAbort = 1028 + ErrFormNotFound = 1029 + ErrGetErrno = 1030 + ErrIllegalHa = 1031 + ErrKeyNotFound = 1032 + ErrNotFormFile = 1033 + ErrNotKeyFile = 1034 + ErrOldKeyFile = 1035 + ErrOpenAsReadonly = 1036 + ErrOutofMemory = 1037 + ErrOutOfSortMemory = 1038 + ErrUnexpectedEOF = 1039 + ErrConCount = 1040 + ErrOutOfResources = 1041 + ErrBadHost = 1042 + ErrHandshake = 1043 + ErrDBaccessDenied = 1044 + ErrAccessDenied = 1045 + ErrNoDB = 1046 + ErrUnknownCom = 1047 + ErrBadNull = 1048 + ErrBadDB = 1049 + ErrTableExists = 1050 + ErrBadTable = 1051 + ErrNonUniq = 1052 + ErrServerShutdown = 1053 + ErrBadField = 1054 + ErrFieldNotInGroupBy = 1055 + ErrWrongGroupField = 1056 + ErrWrongSumSelect = 1057 + ErrWrongValueCount = 1058 + ErrTooLongIdent = 1059 + ErrDupFieldName = 1060 + ErrDupKeyName = 1061 + ErrDupEntry = 1062 + ErrWrongFieldSpec = 1063 + ErrParse = 1064 + ErrEmptyQuery = 1065 + ErrNonuniqTable = 1066 + ErrInvalidDefault = 1067 + ErrMultiplePriKey = 1068 + ErrTooManyKeys = 1069 + ErrTooManyKeyParts = 1070 + ErrTooLongKey = 1071 + ErrKeyColumnDoesNotExits = 1072 + ErrBlobUsedAsKey = 1073 + ErrTooBigFieldlength = 1074 + ErrWrongAutoKey = 1075 + ErrReady = 1076 + ErrNormalShutdown = 1077 + ErrGotSignal = 1078 + ErrShutdownComplete = 1079 + ErrForcingClose = 1080 + ErrIpsock = 1081 + ErrNoSuchIndex = 1082 + ErrWrongFieldTerminators = 1083 + ErrBlobsAndNoTerminated = 1084 + ErrTextFileNotReadable = 1085 + ErrFileExists = 1086 + ErrLoadInfo = 1087 + ErrAlterInfo = 1088 + ErrWrongSubKey = 1089 + ErrCantRemoveAllFields = 1090 + ErrCantDropFieldOrKey = 1091 + ErrInsertInfo = 1092 + ErrUpdateTableUsed = 1093 + ErrNoSuchThread = 1094 + ErrKillDenied = 1095 + ErrNoTablesUsed = 1096 + ErrTooBigSet = 1097 + ErrNoUniqueLogFile = 1098 + ErrTableNotLockedForWrite = 1099 + ErrTableNotLocked = 1100 + ErrBlobCantHaveDefault = 1101 + ErrWrongDBName = 1102 + ErrWrongTableName = 1103 + ErrTooBigSelect = 1104 + ErrUnknown = 1105 + ErrUnknownProcedure = 1106 + ErrWrongParamcountToProcedure = 1107 + ErrWrongParametersToProcedure = 1108 + ErrUnknownTable = 1109 + ErrFieldSpecifiedTwice = 1110 + ErrInvalidGroupFuncUse = 1111 + ErrUnsupportedExtension = 1112 + ErrTableMustHaveColumns = 1113 + ErrRecordFileFull = 1114 + ErrUnknownCharacterSet = 1115 + ErrTooManyTables = 1116 + ErrTooManyFields = 1117 + ErrTooBigRowsize = 1118 + ErrStackOverrun = 1119 + ErrWrongOuterJoin = 1120 + ErrNullColumnInIndex = 1121 + ErrCantFindUdf = 1122 + ErrCantInitializeUdf = 1123 + ErrUdfNoPaths = 1124 + ErrUdfExists = 1125 + ErrCantOpenLibrary = 1126 + ErrCantFindDlEntry = 1127 + ErrFunctionNotDefined = 1128 + ErrHostIsBlocked = 1129 + ErrHostNotPrivileged = 1130 + ErrPasswordAnonymousUser = 1131 + ErrPasswordNotAllowed = 1132 + ErrPasswordNoMatch = 1133 + ErrUpdateInfo = 1134 + ErrCantCreateThread = 1135 + ErrWrongValueCountOnRow = 1136 + ErrCantReopenTable = 1137 + ErrInvalidUseOfNull = 1138 + ErrRegexp = 1139 + ErrMixOfGroupFuncAndFields = 1140 + ErrNonexistingGrant = 1141 + ErrTableaccessDenied = 1142 + ErrColumnaccessDenied = 1143 + ErrIllegalGrantForTable = 1144 + ErrGrantWrongHostOrUser = 1145 + ErrNoSuchTable = 1146 + ErrNonexistingTableGrant = 1147 + ErrNotAllowedCommand = 1148 + ErrSyntax = 1149 + ErrDelayedCantChangeLock = 1150 + ErrTooManyDelayedThreads = 1151 + ErrAbortingConnection = 1152 + ErrNetPacketTooLarge = 1153 + ErrNetReadErrorFromPipe = 1154 + ErrNetFcntl = 1155 + ErrNetPacketsOutOfOrder = 1156 + ErrNetUncompress = 1157 + ErrNetRead = 1158 + ErrNetReadInterrupted = 1159 + ErrNetErrorOnWrite = 1160 + ErrNetWriteInterrupted = 1161 + ErrTooLongString = 1162 + ErrTableCantHandleBlob = 1163 + ErrTableCantHandleAutoIncrement = 1164 + ErrDelayedInsertTableLocked = 1165 + ErrWrongColumnName = 1166 + ErrWrongKeyColumn = 1167 + ErrWrongMrgTable = 1168 + ErrDupUnique = 1169 + ErrBlobKeyWithoutLength = 1170 + ErrPrimaryCantHaveNull = 1171 + ErrTooManyRows = 1172 + ErrRequiresPrimaryKey = 1173 + ErrNoRaidCompiled = 1174 + ErrUpdateWithoutKeyInSafeMode = 1175 + ErrKeyDoesNotExist = 1176 + ErrCheckNoSuchTable = 1177 + ErrCheckNotImplemented = 1178 + ErrCantDoThisDuringAnTransaction = 1179 + ErrErrorDuringCommit = 1180 + ErrErrorDuringRollback = 1181 + ErrErrorDuringFlushLogs = 1182 + ErrErrorDuringCheckpoint = 1183 + ErrNewAbortingConnection = 1184 + ErrDumpNotImplemented = 1185 + ErrFlushMasterBinlogClosed = 1186 + ErrIndexRebuild = 1187 + ErrMaster = 1188 + ErrMasterNetRead = 1189 + ErrMasterNetWrite = 1190 + ErrFtMatchingKeyNotFound = 1191 + ErrLockOrActiveTransaction = 1192 + ErrUnknownSystemVariable = 1193 + ErrCrashedOnUsage = 1194 + ErrCrashedOnRepair = 1195 + ErrWarningNotCompleteRollback = 1196 + ErrTransCacheFull = 1197 + ErrSlaveMustStop = 1198 + ErrSlaveNotRunning = 1199 + ErrBadSlave = 1200 + ErrMasterInfo = 1201 + ErrSlaveThread = 1202 + ErrTooManyUserConnections = 1203 + ErrSetConstantsOnly = 1204 + ErrLockWaitTimeout = 1205 + ErrLockTableFull = 1206 + ErrReadOnlyTransaction = 1207 + ErrDropDBWithReadLock = 1208 + ErrCreateDBWithReadLock = 1209 + ErrWrongArguments = 1210 + ErrNoPermissionToCreateUser = 1211 + ErrUnionTablesInDifferentDir = 1212 + ErrLockDeadlock = 1213 + ErrTableCantHandleFt = 1214 + ErrCannotAddForeign = 1215 + ErrNoReferencedRow = 1216 + ErrRowIsReferenced = 1217 + ErrConnectToMaster = 1218 + ErrQueryOnMaster = 1219 + ErrErrorWhenExecutingCommand = 1220 + ErrWrongUsage = 1221 + ErrWrongNumberOfColumnsInSelect = 1222 + ErrCantUpdateWithReadlock = 1223 + ErrMixingNotAllowed = 1224 + ErrDupArgument = 1225 + ErrUserLimitReached = 1226 + ErrSpecificAccessDenied = 1227 + ErrLocalVariable = 1228 + ErrGlobalVariable = 1229 + ErrNoDefault = 1230 + ErrWrongValueForVar = 1231 + ErrWrongTypeForVar = 1232 + ErrVarCantBeRead = 1233 + ErrCantUseOptionHere = 1234 + ErrNotSupportedYet = 1235 + ErrMasterFatalErrorReadingBinlog = 1236 + ErrSlaveIgnoredTable = 1237 + ErrIncorrectGlobalLocalVar = 1238 + ErrWrongFkDef = 1239 + ErrKeyRefDoNotMatchTableRef = 1240 + ErrOperandColumns = 1241 + ErrSubqueryNo1Row = 1242 + ErrUnknownStmtHandler = 1243 + ErrCorruptHelpDB = 1244 + ErrCyclicReference = 1245 + ErrAutoConvert = 1246 + ErrIllegalReference = 1247 + ErrDerivedMustHaveAlias = 1248 + ErrSelectReduced = 1249 + ErrTablenameNotAllowedHere = 1250 + ErrNotSupportedAuthMode = 1251 + ErrSpatialCantHaveNull = 1252 + ErrCollationCharsetMismatch = 1253 + ErrSlaveWasRunning = 1254 + ErrSlaveWasNotRunning = 1255 + ErrTooBigForUncompress = 1256 + ErrZlibZMem = 1257 + ErrZlibZBuf = 1258 + ErrZlibZData = 1259 + ErrCutValueGroupConcat = 1260 + ErrWarnTooFewRecords = 1261 + ErrWarnTooManyRecords = 1262 + ErrWarnNullToNotnull = 1263 + ErrWarnDataOutOfRange = 1264 + WarnDataTruncated = 1265 + ErrWarnUsingOtherHandler = 1266 + ErrCantAggregate2collations = 1267 + ErrDropUser = 1268 + ErrRevokeGrants = 1269 + ErrCantAggregate3collations = 1270 + ErrCantAggregateNcollations = 1271 + ErrVariableIsNotStruct = 1272 + ErrUnknownCollation = 1273 + ErrSlaveIgnoredSslParams = 1274 + ErrServerIsInSecureAuthMode = 1275 + ErrWarnFieldResolved = 1276 + ErrBadSlaveUntilCond = 1277 + ErrMissingSkipSlave = 1278 + ErrUntilCondIgnored = 1279 + ErrWrongNameForIndex = 1280 + ErrWrongNameForCatalog = 1281 + ErrWarnQcResize = 1282 + ErrBadFtColumn = 1283 + ErrUnknownKeyCache = 1284 + ErrWarnHostnameWontWork = 1285 + ErrUnknownStorageEngine = 1286 + ErrWarnDeprecatedSyntax = 1287 + ErrNonUpdatableTable = 1288 + ErrFeatureDisabled = 1289 + ErrOptionPreventsStatement = 1290 + ErrDuplicatedValueInType = 1291 + ErrTruncatedWrongValue = 1292 + ErrTooMuchAutoTimestampCols = 1293 + ErrInvalidOnUpdate = 1294 + ErrUnsupportedPs = 1295 + ErrGetErrmsg = 1296 + ErrGetTemporaryErrmsg = 1297 + ErrUnknownTimeZone = 1298 + ErrWarnInvalidTimestamp = 1299 + ErrInvalidCharacterString = 1300 + ErrWarnAllowedPacketOverflowed = 1301 + ErrConflictingDeclarations = 1302 + ErrSpNoRecursiveCreate = 1303 + ErrSpAlreadyExists = 1304 + ErrSpDoesNotExist = 1305 + ErrSpDropFailed = 1306 + ErrSpStoreFailed = 1307 + ErrSpLilabelMismatch = 1308 + ErrSpLabelRedefine = 1309 + ErrSpLabelMismatch = 1310 + ErrSpUninitVar = 1311 + ErrSpBadselect = 1312 + ErrSpBadreturn = 1313 + ErrSpBadstatement = 1314 + ErrUpdateLogDeprecatedIgnored = 1315 + ErrUpdateLogDeprecatedTranslated = 1316 + ErrQueryInterrupted = 1317 + ErrSpWrongNoOfArgs = 1318 + ErrSpCondMismatch = 1319 + ErrSpNoreturn = 1320 + ErrSpNoreturnend = 1321 + ErrSpBadCursorQuery = 1322 + ErrSpBadCursorSelect = 1323 + ErrSpCursorMismatch = 1324 + ErrSpCursorAlreadyOpen = 1325 + ErrSpCursorNotOpen = 1326 + ErrSpUndeclaredVar = 1327 + ErrSpWrongNoOfFetchArgs = 1328 + ErrSpFetchNoData = 1329 + ErrSpDupParam = 1330 + ErrSpDupVar = 1331 + ErrSpDupCond = 1332 + ErrSpDupCurs = 1333 + ErrSpCantAlter = 1334 + ErrSpSubselectNyi = 1335 + ErrStmtNotAllowedInSfOrTrg = 1336 + ErrSpVarcondAfterCurshndlr = 1337 + ErrSpCursorAfterHandler = 1338 + ErrSpCaseNotFound = 1339 + ErrFparserTooBigFile = 1340 + ErrFparserBadHeader = 1341 + ErrFparserEOFInComment = 1342 + ErrFparserErrorInParameter = 1343 + ErrFparserEOFInUnknownParameter = 1344 + ErrViewNoExplain = 1345 + ErrFrmUnknownType = 1346 + ErrWrongObject = 1347 + ErrNonupdateableColumn = 1348 + ErrViewSelectDerived = 1349 + ErrViewSelectClause = 1350 + ErrViewSelectVariable = 1351 + ErrViewSelectTmptable = 1352 + ErrViewWrongList = 1353 + ErrWarnViewMerge = 1354 + ErrWarnViewWithoutKey = 1355 + ErrViewInvalid = 1356 + ErrSpNoDropSp = 1357 + ErrSpGotoInHndlr = 1358 + ErrTrgAlreadyExists = 1359 + ErrTrgDoesNotExist = 1360 + ErrTrgOnViewOrTempTable = 1361 + ErrTrgCantChangeRow = 1362 + ErrTrgNoSuchRowInTrg = 1363 + ErrNoDefaultForField = 1364 + ErrDivisionByZero = 1365 + ErrTruncatedWrongValueForField = 1366 + ErrIllegalValueForType = 1367 + ErrViewNonupdCheck = 1368 + ErrViewCheckFailed = 1369 + ErrProcaccessDenied = 1370 + ErrRelayLogFail = 1371 + ErrPasswdLength = 1372 + ErrUnknownTargetBinlog = 1373 + ErrIoErrLogIndexRead = 1374 + ErrBinlogPurgeProhibited = 1375 + ErrFseekFail = 1376 + ErrBinlogPurgeFatalErr = 1377 + ErrLogInUse = 1378 + ErrLogPurgeUnknownErr = 1379 + ErrRelayLogInit = 1380 + ErrNoBinaryLogging = 1381 + ErrReservedSyntax = 1382 + ErrWsasFailed = 1383 + ErrDiffGroupsProc = 1384 + ErrNoGroupForProc = 1385 + ErrOrderWithProc = 1386 + ErrLoggingProhibitChangingOf = 1387 + ErrNoFileMapping = 1388 + ErrWrongMagic = 1389 + ErrPsManyParam = 1390 + ErrKeyPart0 = 1391 + ErrViewChecksum = 1392 + ErrViewMultiupdate = 1393 + ErrViewNoInsertFieldList = 1394 + ErrViewDeleteMergeView = 1395 + ErrCannotUser = 1396 + ErrXaerNota = 1397 + ErrXaerInval = 1398 + ErrXaerRmfail = 1399 + ErrXaerOutside = 1400 + ErrXaerRmerr = 1401 + ErrXaRbrollback = 1402 + ErrNonexistingProcGrant = 1403 + ErrProcAutoGrantFail = 1404 + ErrProcAutoRevokeFail = 1405 + ErrDataTooLong = 1406 + ErrSpBadSQLstate = 1407 + ErrStartup = 1408 + ErrLoadFromFixedSizeRowsToVar = 1409 + ErrCantCreateUserWithGrant = 1410 + ErrWrongValueForType = 1411 + ErrTableDefChanged = 1412 + ErrSpDupHandler = 1413 + ErrSpNotVarArg = 1414 + ErrSpNoRetset = 1415 + ErrCantCreateGeometryObject = 1416 + ErrFailedRoutineBreakBinlog = 1417 + ErrBinlogUnsafeRoutine = 1418 + ErrBinlogCreateRoutineNeedSuper = 1419 + ErrExecStmtWithOpenCursor = 1420 + ErrStmtHasNoOpenCursor = 1421 + ErrCommitNotAllowedInSfOrTrg = 1422 + ErrNoDefaultForViewField = 1423 + ErrSpNoRecursion = 1424 + ErrTooBigScale = 1425 + ErrTooBigPrecision = 1426 + ErrMBiggerThanD = 1427 + ErrWrongLockOfSystemTable = 1428 + ErrConnectToForeignDataSource = 1429 + ErrQueryOnForeignDataSource = 1430 + ErrForeignDataSourceDoesntExist = 1431 + ErrForeignDataStringInvalidCantCreate = 1432 + ErrForeignDataStringInvalid = 1433 + ErrCantCreateFederatedTable = 1434 + ErrTrgInWrongSchema = 1435 + ErrStackOverrunNeedMore = 1436 + ErrTooLongBody = 1437 + ErrWarnCantDropDefaultKeycache = 1438 + ErrTooBigDisplaywidth = 1439 + ErrXaerDupid = 1440 + ErrDatetimeFunctionOverflow = 1441 + ErrCantUpdateUsedTableInSfOrTrg = 1442 + ErrViewPreventUpdate = 1443 + ErrPsNoRecursion = 1444 + ErrSpCantSetAutocommit = 1445 + ErrMalformedDefiner = 1446 + ErrViewFrmNoUser = 1447 + ErrViewOtherUser = 1448 + ErrNoSuchUser = 1449 + ErrForbidSchemaChange = 1450 + ErrRowIsReferenced2 = 1451 + ErrNoReferencedRow2 = 1452 + ErrSpBadVarShadow = 1453 + ErrTrgNoDefiner = 1454 + ErrOldFileFormat = 1455 + ErrSpRecursionLimit = 1456 + ErrSpProcTableCorrupt = 1457 + ErrSpWrongName = 1458 + ErrTableNeedsUpgrade = 1459 + ErrSpNoAggregate = 1460 + ErrMaxPreparedStmtCountReached = 1461 + ErrViewRecursive = 1462 + ErrNonGroupingFieldUsed = 1463 + ErrTableCantHandleSpkeys = 1464 + ErrNoTriggersOnSystemSchema = 1465 + ErrRemovedSpaces = 1466 + ErrAutoincReadFailed = 1467 + ErrUsername = 1468 + ErrHostname = 1469 + ErrWrongStringLength = 1470 + ErrNonInsertableTable = 1471 + ErrAdminWrongMrgTable = 1472 + ErrTooHighLevelOfNestingForSelect = 1473 + ErrNameBecomesEmpty = 1474 + ErrAmbiguousFieldTerm = 1475 + ErrForeignServerExists = 1476 + ErrForeignServerDoesntExist = 1477 + ErrIllegalHaCreateOption = 1478 + ErrPartitionRequiresValues = 1479 + ErrPartitionWrongValues = 1480 + ErrPartitionMaxvalue = 1481 + ErrPartitionSubpartition = 1482 + ErrPartitionSubpartMix = 1483 + ErrPartitionWrongNoPart = 1484 + ErrPartitionWrongNoSubpart = 1485 + ErrWrongExprInPartitionFunc = 1486 + ErrNoConstExprInRangeOrList = 1487 + ErrFieldNotFoundPart = 1488 + ErrListOfFieldsOnlyInHash = 1489 + ErrInconsistentPartitionInfo = 1490 + ErrPartitionFuncNotAllowed = 1491 + ErrPartitionsMustBeDefined = 1492 + ErrRangeNotIncreasing = 1493 + ErrInconsistentTypeOfFunctions = 1494 + ErrMultipleDefConstInListPart = 1495 + ErrPartitionEntry = 1496 + ErrMixHandler = 1497 + ErrPartitionNotDefined = 1498 + ErrTooManyPartitions = 1499 + ErrSubpartition = 1500 + ErrCantCreateHandlerFile = 1501 + ErrBlobFieldInPartFunc = 1502 + ErrUniqueKeyNeedAllFieldsInPf = 1503 + ErrNoParts = 1504 + ErrPartitionMgmtOnNonpartitioned = 1505 + ErrForeignKeyOnPartitioned = 1506 + ErrDropPartitionNonExistent = 1507 + ErrDropLastPartition = 1508 + ErrCoalesceOnlyOnHashPartition = 1509 + ErrReorgHashOnlyOnSameNo = 1510 + ErrReorgNoParam = 1511 + ErrOnlyOnRangeListPartition = 1512 + ErrAddPartitionSubpart = 1513 + ErrAddPartitionNoNewPartition = 1514 + ErrCoalescePartitionNoPartition = 1515 + ErrReorgPartitionNotExist = 1516 + ErrSameNamePartition = 1517 + ErrNoBinlog = 1518 + ErrConsecutiveReorgPartitions = 1519 + ErrReorgOutsideRange = 1520 + ErrPartitionFunctionFailure = 1521 + ErrPartState = 1522 + ErrLimitedPartRange = 1523 + ErrPluginIsNotLoaded = 1524 + ErrWrongValue = 1525 + ErrNoPartitionForGivenValue = 1526 + ErrFilegroupOptionOnlyOnce = 1527 + ErrCreateFilegroupFailed = 1528 + ErrDropFilegroupFailed = 1529 + ErrTablespaceAutoExtend = 1530 + ErrWrongSizeNumber = 1531 + ErrSizeOverflow = 1532 + ErrAlterFilegroupFailed = 1533 + ErrBinlogRowLoggingFailed = 1534 + ErrBinlogRowWrongTableDef = 1535 + ErrBinlogRowRbrToSbr = 1536 + ErrEventAlreadyExists = 1537 + ErrEventStoreFailed = 1538 + ErrEventDoesNotExist = 1539 + ErrEventCantAlter = 1540 + ErrEventDropFailed = 1541 + ErrEventIntervalNotPositiveOrTooBig = 1542 + ErrEventEndsBeforeStarts = 1543 + ErrEventExecTimeInThePast = 1544 + ErrEventOpenTableFailed = 1545 + ErrEventNeitherMExprNorMAt = 1546 + ErrObsoleteColCountDoesntMatchCorrupted = 1547 + ErrObsoleteCannotLoadFromTable = 1548 + ErrEventCannotDelete = 1549 + ErrEventCompile = 1550 + ErrEventSameName = 1551 + ErrEventDataTooLong = 1552 + ErrDropIndexFk = 1553 + ErrWarnDeprecatedSyntaxWithVer = 1554 + ErrCantWriteLockLogTable = 1555 + ErrCantLockLogTable = 1556 + ErrForeignDuplicateKeyOldUnused = 1557 + ErrColCountDoesntMatchPleaseUpdate = 1558 + ErrTempTablePreventsSwitchOutOfRbr = 1559 + ErrStoredFunctionPreventsSwitchBinlogFormat = 1560 + ErrNdbCantSwitchBinlogFormat = 1561 + ErrPartitionNoTemporary = 1562 + ErrPartitionConstDomain = 1563 + ErrPartitionFunctionIsNotAllowed = 1564 + ErrDdlLog = 1565 + ErrNullInValuesLessThan = 1566 + ErrWrongPartitionName = 1567 + ErrCantChangeTxCharacteristics = 1568 + ErrDupEntryAutoincrementCase = 1569 + ErrEventModifyQueue = 1570 + ErrEventSetVar = 1571 + ErrPartitionMerge = 1572 + ErrCantActivateLog = 1573 + ErrRbrNotAvailable = 1574 + ErrBase64Decode = 1575 + ErrEventRecursionForbidden = 1576 + ErrEventsDB = 1577 + ErrOnlyIntegersAllowed = 1578 + ErrUnsuportedLogEngine = 1579 + ErrBadLogStatement = 1580 + ErrCantRenameLogTable = 1581 + ErrWrongParamcountToNativeFct = 1582 + ErrWrongParametersToNativeFct = 1583 + ErrWrongParametersToStoredFct = 1584 + ErrNativeFctNameCollision = 1585 + ErrDupEntryWithKeyName = 1586 + ErrBinlogPurgeEmFile = 1587 + ErrEventCannotCreateInThePast = 1588 + ErrEventCannotAlterInThePast = 1589 + ErrSlaveIncident = 1590 + ErrNoPartitionForGivenValueSilent = 1591 + ErrBinlogUnsafeStatement = 1592 + ErrSlaveFatal = 1593 + ErrSlaveRelayLogReadFailure = 1594 + ErrSlaveRelayLogWriteFailure = 1595 + ErrSlaveCreateEventFailure = 1596 + ErrSlaveMasterComFailure = 1597 + ErrBinlogLoggingImpossible = 1598 + ErrViewNoCreationCtx = 1599 + ErrViewInvalidCreationCtx = 1600 + ErrSrInvalidCreationCtx = 1601 + ErrTrgCorruptedFile = 1602 + ErrTrgNoCreationCtx = 1603 + ErrTrgInvalidCreationCtx = 1604 + ErrEventInvalidCreationCtx = 1605 + ErrTrgCantOpenTable = 1606 + ErrCantCreateSroutine = 1607 + ErrNeverUsed = 1608 + ErrNoFormatDescriptionEventBeforeBinlogStatement = 1609 + ErrSlaveCorruptEvent = 1610 + ErrLoadDataInvalidColumn = 1611 + ErrLogPurgeNoFile = 1612 + ErrXaRbtimeout = 1613 + ErrXaRbdeadlock = 1614 + ErrNeedReprepare = 1615 + ErrDelayedNotSupported = 1616 + WarnNoMasterInfo = 1617 + WarnOptionIgnored = 1618 + WarnPluginDeleteBuiltin = 1619 + WarnPluginBusy = 1620 + ErrVariableIsReadonly = 1621 + ErrWarnEngineTransactionRollback = 1622 + ErrSlaveHeartbeatFailure = 1623 + ErrSlaveHeartbeatValueOutOfRange = 1624 + ErrNdbReplicationSchema = 1625 + ErrConflictFnParse = 1626 + ErrExceptionsWrite = 1627 + ErrTooLongTableComment = 1628 + ErrTooLongFieldComment = 1629 + ErrFuncInexistentNameCollision = 1630 + ErrDatabaseName = 1631 + ErrTableName = 1632 + ErrPartitionName = 1633 + ErrSubpartitionName = 1634 + ErrTemporaryName = 1635 + ErrRenamedName = 1636 + ErrTooManyConcurrentTrxs = 1637 + WarnNonASCIISeparatorNotImplemented = 1638 + ErrDebugSyncTimeout = 1639 + ErrDebugSyncHitLimit = 1640 + ErrDupSignalSet = 1641 + ErrSignalWarn = 1642 + ErrSignalNotFound = 1643 + ErrSignalException = 1644 + ErrResignalWithoutActiveHandler = 1645 + ErrSignalBadConditionType = 1646 + WarnCondItemTruncated = 1647 + ErrCondItemTooLong = 1648 + ErrUnknownLocale = 1649 + ErrSlaveIgnoreServerIds = 1650 + ErrQueryCacheDisabled = 1651 + ErrSameNamePartitionField = 1652 + ErrPartitionColumnList = 1653 + ErrWrongTypeColumnValue = 1654 + ErrTooManyPartitionFuncFields = 1655 + ErrMaxvalueInValuesIn = 1656 + ErrTooManyValues = 1657 + ErrRowSinglePartitionField = 1658 + ErrFieldTypeNotAllowedAsPartitionField = 1659 + ErrPartitionFieldsTooLong = 1660 + ErrBinlogRowEngineAndStmtEngine = 1661 + ErrBinlogRowModeAndStmtEngine = 1662 + ErrBinlogUnsafeAndStmtEngine = 1663 + ErrBinlogRowInjectionAndStmtEngine = 1664 + ErrBinlogStmtModeAndRowEngine = 1665 + ErrBinlogRowInjectionAndStmtMode = 1666 + ErrBinlogMultipleEnginesAndSelfLoggingEngine = 1667 + ErrBinlogUnsafeLimit = 1668 + ErrBinlogUnsafeInsertDelayed = 1669 + ErrBinlogUnsafeSystemTable = 1670 + ErrBinlogUnsafeAutoincColumns = 1671 + ErrBinlogUnsafeUdf = 1672 + ErrBinlogUnsafeSystemVariable = 1673 + ErrBinlogUnsafeSystemFunction = 1674 + ErrBinlogUnsafeNontransAfterTrans = 1675 + ErrMessageAndStatement = 1676 + ErrSlaveConversionFailed = 1677 + ErrSlaveCantCreateConversion = 1678 + ErrInsideTransactionPreventsSwitchBinlogFormat = 1679 + ErrPathLength = 1680 + ErrWarnDeprecatedSyntaxNoReplacement = 1681 + ErrWrongNativeTableStructure = 1682 + ErrWrongPerfSchemaUsage = 1683 + ErrWarnISSkippedTable = 1684 + ErrInsideTransactionPreventsSwitchBinlogDirect = 1685 + ErrStoredFunctionPreventsSwitchBinlogDirect = 1686 + ErrSpatialMustHaveGeomCol = 1687 + ErrTooLongIndexComment = 1688 + ErrLockAborted = 1689 + ErrDataOutOfRange = 1690 + ErrWrongSpvarTypeInLimit = 1691 + ErrBinlogUnsafeMultipleEnginesAndSelfLoggingEngine = 1692 + ErrBinlogUnsafeMixedStatement = 1693 + ErrInsideTransactionPreventsSwitchSQLLogBin = 1694 + ErrStoredFunctionPreventsSwitchSQLLogBin = 1695 + ErrFailedReadFromParFile = 1696 + ErrValuesIsNotIntType = 1697 + ErrAccessDeniedNoPassword = 1698 + ErrSetPasswordAuthPlugin = 1699 + ErrGrantPluginUserExists = 1700 + ErrTruncateIllegalFk = 1701 + ErrPluginIsPermanent = 1702 + ErrSlaveHeartbeatValueOutOfRangeMin = 1703 + ErrSlaveHeartbeatValueOutOfRangeMax = 1704 + ErrStmtCacheFull = 1705 + ErrMultiUpdateKeyConflict = 1706 + ErrTableNeedsRebuild = 1707 + WarnOptionBelowLimit = 1708 + ErrIndexColumnTooLong = 1709 + ErrErrorInTriggerBody = 1710 + ErrErrorInUnknownTriggerBody = 1711 + ErrIndexCorrupt = 1712 + ErrUndoRecordTooBig = 1713 + ErrBinlogUnsafeInsertIgnoreSelect = 1714 + ErrBinlogUnsafeInsertSelectUpdate = 1715 + ErrBinlogUnsafeReplaceSelect = 1716 + ErrBinlogUnsafeCreateIgnoreSelect = 1717 + ErrBinlogUnsafeCreateReplaceSelect = 1718 + ErrBinlogUnsafeUpdateIgnore = 1719 + ErrPluginNoUninstall = 1720 + ErrPluginNoInstall = 1721 + ErrBinlogUnsafeWriteAutoincSelect = 1722 + ErrBinlogUnsafeCreateSelectAutoinc = 1723 + ErrBinlogUnsafeInsertTwoKeys = 1724 + ErrTableInFkCheck = 1725 + ErrUnsupportedEngine = 1726 + ErrBinlogUnsafeAutoincNotFirst = 1727 + ErrCannotLoadFromTableV2 = 1728 + ErrMasterDelayValueOutOfRange = 1729 + ErrOnlyFdAndRbrEventsAllowedInBinlogStatement = 1730 + ErrPartitionExchangeDifferentOption = 1731 + ErrPartitionExchangePartTable = 1732 + ErrPartitionExchangeTempTable = 1733 + ErrPartitionInsteadOfSubpartition = 1734 + ErrUnknownPartition = 1735 + ErrTablesDifferentMetadata = 1736 + ErrRowDoesNotMatchPartition = 1737 + ErrBinlogCacheSizeGreaterThanMax = 1738 + ErrWarnIndexNotApplicable = 1739 + ErrPartitionExchangeForeignKey = 1740 + ErrNoSuchKeyValue = 1741 + ErrRplInfoDataTooLong = 1742 + ErrNetworkReadEventChecksumFailure = 1743 + ErrBinlogReadEventChecksumFailure = 1744 + ErrBinlogStmtCacheSizeGreaterThanMax = 1745 + ErrCantUpdateTableInCreateTableSelect = 1746 + ErrPartitionClauseOnNonpartitioned = 1747 + ErrRowDoesNotMatchGivenPartitionSet = 1748 + ErrNoSuchPartitionunused = 1749 + ErrChangeRplInfoRepositoryFailure = 1750 + ErrWarningNotCompleteRollbackWithCreatedTempTable = 1751 + ErrWarningNotCompleteRollbackWithDroppedTempTable = 1752 + ErrMtsFeatureIsNotSupported = 1753 + ErrMtsUpdatedDBsGreaterMax = 1754 + ErrMtsCantParallel = 1755 + ErrMtsInconsistentData = 1756 + ErrFulltextNotSupportedWithPartitioning = 1757 + ErrDaInvalidConditionNumber = 1758 + ErrInsecurePlainText = 1759 + ErrInsecureChangeMaster = 1760 + ErrForeignDuplicateKeyWithChildInfo = 1761 + ErrForeignDuplicateKeyWithoutChildInfo = 1762 + ErrSQLthreadWithSecureSlave = 1763 + ErrTableHasNoFt = 1764 + ErrVariableNotSettableInSfOrTrigger = 1765 + ErrVariableNotSettableInTransaction = 1766 + ErrGtidNextIsNotInGtidNextList = 1767 + ErrCantChangeGtidNextInTransactionWhenGtidNextListIsNull = 1768 + ErrSetStatementCannotInvokeFunction = 1769 + ErrGtidNextCantBeAutomaticIfGtidNextListIsNonNull = 1770 + ErrSkippingLoggedTransaction = 1771 + ErrMalformedGtidSetSpecification = 1772 + ErrMalformedGtidSetEncoding = 1773 + ErrMalformedGtidSpecification = 1774 + ErrGnoExhausted = 1775 + ErrBadSlaveAutoPosition = 1776 + ErrAutoPositionRequiresGtidModeOn = 1777 + ErrCantDoImplicitCommitInTrxWhenGtidNextIsSet = 1778 + ErrGtidMode2Or3RequiresEnforceGtidConsistencyOn = 1779 + ErrGtidModeRequiresBinlog = 1780 + ErrCantSetGtidNextToGtidWhenGtidModeIsOff = 1781 + ErrCantSetGtidNextToAnonymousWhenGtidModeIsOn = 1782 + ErrCantSetGtidNextListToNonNullWhenGtidModeIsOff = 1783 + ErrFoundGtidEventWhenGtidModeIsOff = 1784 + ErrGtidUnsafeNonTransactionalTable = 1785 + ErrGtidUnsafeCreateSelect = 1786 + ErrGtidUnsafeCreateDropTemporaryTableInTransaction = 1787 + ErrGtidModeCanOnlyChangeOneStepAtATime = 1788 + ErrMasterHasPurgedRequiredGtids = 1789 + ErrCantSetGtidNextWhenOwningGtid = 1790 + ErrUnknownExplainFormat = 1791 + ErrCantExecuteInReadOnlyTransaction = 1792 + ErrTooLongTablePartitionComment = 1793 + ErrSlaveConfiguration = 1794 + ErrInnodbFtLimit = 1795 + ErrInnodbNoFtTempTable = 1796 + ErrInnodbFtWrongDocidColumn = 1797 + ErrInnodbFtWrongDocidIndex = 1798 + ErrInnodbOnlineLogTooBig = 1799 + ErrUnknownAlterAlgorithm = 1800 + ErrUnknownAlterLock = 1801 + ErrMtsChangeMasterCantRunWithGaps = 1802 + ErrMtsRecoveryFailure = 1803 + ErrMtsResetWorkers = 1804 + ErrColCountDoesntMatchCorruptedV2 = 1805 + ErrSlaveSilentRetryTransaction = 1806 + ErrDiscardFkChecksRunning = 1807 + ErrTableSchemaMismatch = 1808 + ErrTableInSystemTablespace = 1809 + ErrIoRead = 1810 + ErrIoWrite = 1811 + ErrTablespaceMissing = 1812 + ErrTablespaceExists = 1813 + ErrTablespaceDiscarded = 1814 + ErrInternal = 1815 + ErrInnodbImport = 1816 + ErrInnodbIndexCorrupt = 1817 + ErrInvalidYearColumnLength = 1818 + ErrNotValidPassword = 1819 + ErrMustChangePassword = 1820 + ErrFkNoIndexChild = 1821 + ErrFkNoIndexParent = 1822 + ErrFkFailAddSystem = 1823 + ErrFkCannotOpenParent = 1824 + ErrFkIncorrectOption = 1825 + ErrFkDupName = 1826 + ErrPasswordFormat = 1827 + ErrFkColumnCannotDrop = 1828 + ErrFkColumnCannotDropChild = 1829 + ErrFkColumnNotNull = 1830 + ErrDupIndex = 1831 + ErrFkColumnCannotChange = 1832 + ErrFkColumnCannotChangeChild = 1833 + ErrFkCannotDeleteParent = 1834 + ErrMalformedPacket = 1835 + ErrReadOnlyMode = 1836 + ErrGtidNextTypeUndefinedGroup = 1837 + ErrVariableNotSettableInSp = 1838 + ErrCantSetGtidPurgedWhenGtidModeIsOff = 1839 + ErrCantSetGtidPurgedWhenGtidExecutedIsNotEmpty = 1840 + ErrCantSetGtidPurgedWhenOwnedGtidsIsNotEmpty = 1841 + ErrGtidPurgedWasChanged = 1842 + ErrGtidExecutedWasChanged = 1843 + ErrBinlogStmtModeAndNoReplTables = 1844 + ErrAlterOperationNotSupported = 1845 + ErrAlterOperationNotSupportedReason = 1846 + ErrAlterOperationNotSupportedReasonCopy = 1847 + ErrAlterOperationNotSupportedReasonPartition = 1848 + ErrAlterOperationNotSupportedReasonFkRename = 1849 + ErrAlterOperationNotSupportedReasonColumnType = 1850 + ErrAlterOperationNotSupportedReasonFkCheck = 1851 + ErrAlterOperationNotSupportedReasonIgnore = 1852 + ErrAlterOperationNotSupportedReasonNopk = 1853 + ErrAlterOperationNotSupportedReasonAutoinc = 1854 + ErrAlterOperationNotSupportedReasonHiddenFts = 1855 + ErrAlterOperationNotSupportedReasonChangeFts = 1856 + ErrAlterOperationNotSupportedReasonFts = 1857 + ErrSQLSlaveSkipCounterNotSettableInGtidMode = 1858 + ErrDupUnknownInIndex = 1859 + ErrIdentCausesTooLongPath = 1860 + ErrAlterOperationNotSupportedReasonNotNull = 1861 + ErrMustChangePasswordLogin = 1862 + ErrRowInWrongPartition = 1863 + ErrErrorLast = 1863 + ErrMaxExecTimeExceeded = 1907 + ErrInvalidFieldSize = 3013 + ErrIncorrectType = 3064 + ErrInvalidJSONData = 3069 + ErrGeneratedColumnFunctionIsNotAllowed = 3102 + ErrUnsupportedAlterInplaceOnVirtualColumn = 3103 + ErrWrongFKOptionForGeneratedColumn = 3104 + ErrBadGeneratedColumn = 3105 + ErrUnsupportedOnGeneratedColumn = 3106 + ErrGeneratedColumnNonPrior = 3107 + ErrDependentByGeneratedColumn = 3108 + ErrGeneratedColumnRefAutoInc = 3109 + ErrInvalidJSONText = 3140 + ErrInvalidJSONPath = 3143 + ErrInvalidTypeForJSON = 3146 + ErrInvalidJSONPathWildcard = 3149 + ErrInvalidJSONContainsPathType = 3150 + ErrJSONUsedAsKey = 3152 + ErrJSONDocumentNULLKey = 3158 + ErrBadUser = 3162 + ErrUserAlreadyExists = 3163 + ErrInvalidJSONPathArrayCell = 3165 + ErrInvalidEncryptionOption = 3184 + ErrRoleNotGranted = 3530 + ErrLockAcquireFailAndNoWaitSet = 3572 + ErrWindowNoSuchWindow = 3579 + ErrWindowCircularityInWindowGraph = 3580 + ErrWindowNoChildPartitioning = 3581 + ErrWindowNoInherentFrame = 3582 + ErrWindowNoRedefineOrderBy = 3583 + ErrWindowFrameStartIllegal = 3584 + ErrWindowFrameEndIllegal = 3585 + ErrWindowFrameIllegal = 3586 + ErrWindowRangeFrameOrderType = 3587 + ErrWindowRangeFrameTemporalType = 3588 + ErrWindowRangeFrameNumericType = 3589 + ErrWindowRangeBoundNotConstant = 3590 + ErrWindowDuplicateName = 3591 + ErrWindowIllegalOrderBy = 3592 + ErrWindowInvalidWindowFuncUse = 3593 + ErrWindowInvalidWindowFuncAliasUse = 3594 + ErrWindowNestedWindowFuncUseInWindowSpec = 3595 + ErrWindowRowsIntervalUse = 3596 + ErrWindowNoGroupOrderUnused = 3597 + ErrWindowExplainJson = 3598 + ErrWindowFunctionIgnoresFrame = 3599 + ErrDataTruncatedFunctionalIndex = 3751 + ErrDataOutOfRangeFunctionalIndex = 3752 + ErrFunctionalIndexOnJsonOrGeometryFunction = 3753 + ErrFunctionalIndexRefAutoIncrement = 3754 + ErrCannotDropColumnFunctionalIndex = 3755 + ErrFunctionalIndexPrimaryKey = 3756 + ErrFunctionalIndexOnLob = 3757 + ErrFunctionalIndexFunctionIsNotAllowed = 3758 + ErrFulltextFunctionalIndex = 3759 + ErrSpatialFunctionalIndex = 3760 + ErrWrongKeyColumnFunctionalIndex = 3761 + ErrFunctionalIndexOnField = 3762 + ErrFKIncompatibleColumns = 3780 + ErrFunctionalIndexRowValueIsNotAllowed = 3800 + ErrDependentByFunctionalIndex = 3837 + ErrInvalidJsonValueForFuncIndex = 3903 + ErrJsonValueOutOfRangeForFuncIndex = 3904 + ErrFunctionalIndexDataIsTooLong = 3907 + ErrFunctionalIndexNotApplicable = 3909 + + // MariaDB errors. + ErrOnlyOneDefaultPartionAllowed = 4030 + ErrWrongPartitionTypeExpectedSystemTime = 4113 + ErrSystemVersioningWrongPartitions = 4128 + ErrSequenceRunOut = 4135 + ErrSequenceInvalidData = 4136 + ErrSequenceAccessFail = 4137 + ErrNotSequence = 4138 + ErrUnknownSequence = 4139 + 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 + ErrMixOfGroupFuncAndFieldsIncompatible = 8123 + + // Error codes used by TiDB ddl package + ErrUnsupportedDDLOperation = 8200 + ErrNotOwner = 8201 + ErrCantDecodeIndex = 8202 + ErrInvalidDDLWorker = 8203 + ErrInvalidDDLJob = 8204 + ErrInvalidDDLJobFlag = 8205 + ErrWaitReorgTimeout = 8206 + ErrInvalidStoreVersion = 8207 + ErrUnknownTypeLength = 8208 + ErrUnknownFractionLength = 8209 + ErrInvalidDDLState = 8210 + ErrReorgPanic = 8211 + ErrInvalidSplitRegionRanges = 8212 + ErrInvalidDDLJobVersion = 8213 + ErrCancelledDDLJob = 8214 + ErrRepairTable = 8215 + ErrInvalidAutoRandom = 8216 + ErrInvalidHashKeyFlag = 8217 + ErrInvalidListIndex = 8218 + ErrInvalidListMetaData = 8219 + ErrWriteOnSnapshot = 8220 + ErrInvalidKey = 8221 + ErrInvalidIndexKey = 8222 + ErrDataInConsistent = 8223 + ErrDDLJobNotFound = 8224 + ErrCancelFinishedDDLJob = 8225 + ErrCannotCancelDDLJob = 8226 + ErrSequenceUnsupportedTableOption = 8227 + ErrColumnTypeUnsupportedNextValue = 8228 + + // TiKV/PD errors. + ErrPDServerTimeout = 9001 + ErrTiKVServerTimeout = 9002 + ErrTiKVServerBusy = 9003 + ErrResolveLockTimeout = 9004 + ErrRegionUnavailable = 9005 + ErrGCTooEarly = 9006 + ErrWriteConflict = 9007 + ErrTiKVStoreLimit = 9008 +) diff --git a/errno/errname.go b/errno/errname.go new file mode 100644 index 0000000000000..b16121166ecd1 --- /dev/null +++ b/errno/errname.go @@ -0,0 +1,1078 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package errno + +// MySQLErrName maps error code to MySQL error messages. +var MySQLErrName = map[uint16]string{ + ErrHashchk: "hashchk", + ErrNisamchk: "isamchk", + ErrNo: "NO", + ErrYes: "YES", + ErrCantCreateFile: "Can't create file '%-.200s' (errno: %d - %s)", + ErrCantCreateTable: "Can't create table '%-.200s' (errno: %d)", + ErrCantCreateDB: "Can't create database '%-.192s' (errno: %d)", + ErrDBCreateExists: "Can't create database '%-.192s'; database exists", + ErrDBDropExists: "Can't drop database '%-.192s'; database doesn't exist", + ErrDBDropDelete: "Error dropping database (can't delete '%-.192s', errno: %d)", + ErrDBDropRmdir: "Error dropping database (can't rmdir '%-.192s', errno: %d)", + ErrCantDeleteFile: "Error on delete of '%-.192s' (errno: %d - %s)", + ErrCantFindSystemRec: "Can't read record in system table", + ErrCantGetStat: "Can't get status of '%-.200s' (errno: %d - %s)", + ErrCantGetWd: "Can't get working directory (errno: %d - %s)", + ErrCantLock: "Can't lock file (errno: %d - %s)", + ErrCantOpenFile: "Can't open file: '%-.200s' (errno: %d - %s)", + ErrFileNotFound: "Can't find file: '%-.200s' (errno: %d - %s)", + ErrCantReadDir: "Can't read dir of '%-.192s' (errno: %d - %s)", + ErrCantSetWd: "Can't change dir to '%-.192s' (errno: %d - %s)", + ErrCheckread: "Record has changed since last read in table '%-.192s'", + ErrDiskFull: "Disk full (%s); waiting for someone to free some space... (errno: %d - %s)", + ErrDupKey: "Can't write; duplicate key in table '%-.192s'", + ErrErrorOnClose: "Error on close of '%-.192s' (errno: %d - %s)", + ErrErrorOnRead: "Error reading file '%-.200s' (errno: %d - %s)", + ErrErrorOnRename: "Error on rename of '%-.210s' to '%-.210s' (errno: %d - %s)", + ErrErrorOnWrite: "Error writing file '%-.200s' (errno: %d - %s)", + ErrFileUsed: "'%-.192s' is locked against change", + ErrFilsortAbort: "Sort aborted", + ErrFormNotFound: "View '%-.192s' doesn't exist for '%-.192s'", + ErrGetErrno: "Got error %d from storage engine", + ErrIllegalHa: "Table storage engine for '%-.192s' doesn't have this option", + ErrKeyNotFound: "Can't find record in '%-.192s'", + ErrNotFormFile: "Incorrect information in file: '%-.200s'", + ErrNotKeyFile: "Incorrect key file for table '%-.200s'; try to repair it", + ErrOldKeyFile: "Old key file for table '%-.192s'; repair it!", + ErrOpenAsReadonly: "Table '%-.192s' is read only", + ErrOutofMemory: "Out of memory; restart server and try again (needed %d bytes)", + ErrOutOfSortMemory: "Out of sort memory, consider increasing server sort buffer size", + ErrUnexpectedEOF: "Unexpected EOF found when reading file '%-.192s' (errno: %d - %s)", + ErrConCount: "Too many connections", + ErrOutOfResources: "Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space", + ErrBadHost: "Can't get hostname for your address", + ErrHandshake: "Bad handshake", + ErrDBaccessDenied: "Access denied for user '%-.48s'@'%-.64s' to database '%-.192s'", + ErrAccessDenied: "Access denied for user '%-.48s'@'%-.64s' (using password: %s)", + ErrNoDB: "No database selected", + ErrUnknownCom: "Unknown command", + ErrBadNull: "Column '%-.192s' cannot be null", + ErrBadDB: "Unknown database '%-.192s'", + ErrTableExists: "Table '%-.192s' already exists", + ErrBadTable: "Unknown table '%-.100s'", + ErrNonUniq: "Column '%-.192s' in %-.192s is ambiguous", + ErrServerShutdown: "Server shutdown in progress", + ErrBadField: "Unknown column '%-.192s' in '%-.192s'", + ErrFieldNotInGroupBy: "Expression #%d of %s 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", + ErrWrongGroupField: "Can't group on '%-.192s'", + ErrWrongSumSelect: "Statement has sum functions and columns in same statement", + ErrWrongValueCount: "Column count doesn't match value count", + ErrTooLongIdent: "Identifier name '%-.100s' is too long", + ErrDupFieldName: "Duplicate column name '%-.192s'", + ErrDupKeyName: "Duplicate key name '%-.192s'", + ErrDupEntry: "Duplicate entry '%-.64s' for key '%-.192s'", + ErrWrongFieldSpec: "Incorrect column specifier for column '%-.192s'", + ErrParse: "%s %s", + ErrEmptyQuery: "Query was empty", + ErrNonuniqTable: "Not unique table/alias: '%-.192s'", + ErrInvalidDefault: "Invalid default value for '%-.192s'", + ErrMultiplePriKey: "Multiple primary key defined", + ErrTooManyKeys: "Too many keys specified; max %d keys allowed", + ErrTooManyKeyParts: "Too many key parts specified; max %d parts allowed", + ErrTooLongKey: "Specified key was too long; max key length is %d bytes", + ErrKeyColumnDoesNotExits: "Key column '%-.192s' doesn't exist in table", + ErrBlobUsedAsKey: "BLOB column '%-.192s' can't be used in key specification with the used table type", + ErrTooBigFieldlength: "Column length too big for column '%-.192s' (max = %d); use BLOB or TEXT instead", + ErrWrongAutoKey: "Incorrect table definition; there can be only one auto column and it must be defined as a key", + ErrReady: "%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d", + ErrNormalShutdown: "%s: Normal shutdown\n", + ErrGotSignal: "%s: Got signal %d. Aborting!\n", + ErrShutdownComplete: "%s: Shutdown complete\n", + ErrForcingClose: "%s: Forcing close of thread %d user: '%-.48s'\n", + ErrIpsock: "Can't create IP socket", + ErrNoSuchIndex: "Table '%-.192s' has no index like the one used in CREATE INDEX; recreate the table", + ErrWrongFieldTerminators: "Field separator argument is not what is expected; check the manual", + ErrBlobsAndNoTerminated: "You can't use fixed rowlength with BLOBs; please use 'fields terminated by'", + ErrTextFileNotReadable: "The file '%-.128s' must be in the database directory or be readable by all", + ErrFileExists: "File '%-.200s' already exists", + ErrLoadInfo: "Records: %d Deleted: %d Skipped: %d Warnings: %d", + ErrAlterInfo: "Records: %d Duplicates: %d", + ErrWrongSubKey: "Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys", + ErrCantRemoveAllFields: "You can't delete all columns with ALTER TABLE; use DROP TABLE instead", + ErrCantDropFieldOrKey: "Can't DROP '%-.192s'; check that column/key exists", + ErrInsertInfo: "Records: %d Duplicates: %d Warnings: %d", + ErrUpdateTableUsed: "You can't specify target table '%-.192s' for update in FROM clause", + ErrNoSuchThread: "Unknown thread id: %d", + ErrKillDenied: "You are not owner of thread %d", + ErrNoTablesUsed: "No tables used", + ErrTooBigSet: "Too many strings for column %-.192s and SET", + ErrNoUniqueLogFile: "Can't generate a unique log-filename %-.200s.(1-999)\n", + ErrTableNotLockedForWrite: "Table '%-.192s' was locked with a READ lock and can't be updated", + ErrTableNotLocked: "Table '%-.192s' was not locked with LOCK TABLES", + ErrBlobCantHaveDefault: "BLOB/TEXT/JSON column '%-.192s' can't have a default value", + ErrWrongDBName: "Incorrect database name '%-.100s'", + ErrWrongTableName: "Incorrect table name '%-.100s'", + ErrTooBigSelect: "The SELECT would examine more than MAXJOINSIZE rows; check your WHERE and use SET SQLBIGSELECTS=1 or SET MAXJOINSIZE=# if the SELECT is okay", + ErrUnknown: "Unknown error", + ErrUnknownProcedure: "Unknown procedure '%-.192s'", + ErrWrongParamcountToProcedure: "Incorrect parameter count to procedure '%-.192s'", + ErrWrongParametersToProcedure: "Incorrect parameters to procedure '%-.192s'", + ErrUnknownTable: "Unknown table '%-.192s' in %-.32s", + ErrFieldSpecifiedTwice: "Column '%-.192s' specified twice", + ErrInvalidGroupFuncUse: "Invalid use of group function", + ErrUnsupportedExtension: "Table '%-.192s' uses an extension that doesn't exist in this MySQL version", + ErrTableMustHaveColumns: "A table must have at least 1 column", + ErrRecordFileFull: "The table '%-.192s' is full", + ErrUnknownCharacterSet: "Unknown character set: '%-.64s'", + ErrTooManyTables: "Too many tables; MySQL can only use %d tables in a join", + ErrTooManyFields: "Too many columns", + ErrTooBigRowsize: "Row size too large. The maximum row size for the used table type, not counting BLOBs, is %d. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs", + ErrStackOverrun: "Thread stack overrun: Used: %d of a %d stack. Use 'mysqld --threadStack=#' to specify a bigger stack if needed", + ErrWrongOuterJoin: "Cross dependency found in OUTER JOIN; examine your ON conditions", + ErrNullColumnInIndex: "Table handler doesn't support NULL in given index. Please change column '%-.192s' to be NOT NULL or use another handler", + ErrCantFindUdf: "Can't load function '%-.192s'", + ErrCantInitializeUdf: "Can't initialize function '%-.192s'; %-.80s", + ErrUdfNoPaths: "No paths allowed for shared library", + ErrUdfExists: "Function '%-.192s' already exists", + ErrCantOpenLibrary: "Can't open shared library '%-.192s' (errno: %d %-.128s)", + ErrCantFindDlEntry: "Can't find symbol '%-.128s' in library", + ErrFunctionNotDefined: "Function '%-.192s' is not defined", + ErrHostIsBlocked: "Host '%-.64s' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'", + ErrHostNotPrivileged: "Host '%-.64s' is not allowed to connect to this MySQL server", + ErrPasswordAnonymousUser: "You are using MySQL as an anonymous user and anonymous users are not allowed to change passwords", + ErrPasswordNotAllowed: "You must have privileges to update tables in the mysql database to be able to change passwords for others", + ErrPasswordNoMatch: "Can't find any matching row in the user table", + ErrUpdateInfo: "Rows matched: %d Changed: %d Warnings: %d", + ErrCantCreateThread: "Can't create a new thread (errno %d); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug", + ErrWrongValueCountOnRow: "Column count doesn't match value count at row %d", + ErrCantReopenTable: "Can't reopen table: '%-.192s'", + ErrInvalidUseOfNull: "Invalid use of NULL value", + ErrRegexp: "Got error '%-.64s' from regexp", + ErrMixOfGroupFuncAndFields: "Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause", + ErrNonexistingGrant: "There is no such grant defined for user '%-.48s' on host '%-.64s'", + ErrTableaccessDenied: "%-.128s command denied to user '%-.48s'@'%-.64s' for table '%-.64s'", + ErrColumnaccessDenied: "%-.16s command denied to user '%-.48s'@'%-.64s' for column '%-.192s' in table '%-.192s'", + ErrIllegalGrantForTable: "Illegal GRANT/REVOKE command; please consult the manual to see which privileges can be used", + ErrGrantWrongHostOrUser: "The host or user argument to GRANT is too long", + ErrNoSuchTable: "Table '%-.192s.%-.192s' doesn't exist", + ErrNonexistingTableGrant: "There is no such grant defined for user '%-.48s' on host '%-.64s' on table '%-.192s'", + ErrNotAllowedCommand: "The used command is not allowed with this MySQL version", + ErrSyntax: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use", + ErrDelayedCantChangeLock: "Delayed insert thread couldn't get requested lock for table %-.192s", + ErrTooManyDelayedThreads: "Too many delayed threads in use", + ErrAbortingConnection: "Aborted connection %d to db: '%-.192s' user: '%-.48s' (%-.64s)", + ErrNetPacketTooLarge: "Got a packet bigger than 'maxAllowedPacket' bytes", + ErrNetReadErrorFromPipe: "Got a read error from the connection pipe", + ErrNetFcntl: "Got an error from fcntl()", + ErrNetPacketsOutOfOrder: "Got packets out of order", + ErrNetUncompress: "Couldn't uncompress communication packet", + ErrNetRead: "Got an error reading communication packets", + ErrNetReadInterrupted: "Got timeout reading communication packets", + ErrNetErrorOnWrite: "Got an error writing communication packets", + ErrNetWriteInterrupted: "Got timeout writing communication packets", + ErrTooLongString: "Result string is longer than 'maxAllowedPacket' bytes", + ErrTableCantHandleBlob: "The used table type doesn't support BLOB/TEXT columns", + ErrTableCantHandleAutoIncrement: "The used table type doesn't support AUTOINCREMENT columns", + ErrDelayedInsertTableLocked: "INSERT DELAYED can't be used with table '%-.192s' because it is locked with LOCK TABLES", + ErrWrongColumnName: "Incorrect column name '%-.100s'", + ErrWrongKeyColumn: "The used storage engine can't index column '%-.192s'", + ErrWrongMrgTable: "Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist", + ErrDupUnique: "Can't write, because of unique constraint, to table '%-.192s'", + ErrBlobKeyWithoutLength: "BLOB/TEXT column '%-.192s' used in key specification without a key length", + ErrPrimaryCantHaveNull: "All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead", + ErrTooManyRows: "Result consisted of more than one row", + ErrRequiresPrimaryKey: "This table type requires a primary key", + ErrNoRaidCompiled: "This version of MySQL is not compiled with RAID support", + ErrUpdateWithoutKeyInSafeMode: "You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column", + ErrKeyDoesNotExist: "Key '%-.192s' doesn't exist in table '%-.192s'", + ErrCheckNoSuchTable: "Can't open table", + ErrCheckNotImplemented: "The storage engine for the table doesn't support %s", + ErrCantDoThisDuringAnTransaction: "You are not allowed to execute this command in a transaction", + ErrErrorDuringCommit: "Got error %d during COMMIT", + ErrErrorDuringRollback: "Got error %d during ROLLBACK", + ErrErrorDuringFlushLogs: "Got error %d during FLUSHLOGS", + ErrErrorDuringCheckpoint: "Got error %d during CHECKPOINT", + ErrNewAbortingConnection: "Aborted connection %d to db: '%-.192s' user: '%-.48s' host: '%-.64s' (%-.64s)", + ErrDumpNotImplemented: "The storage engine for the table does not support binary table dump", + ErrFlushMasterBinlogClosed: "Binlog closed, cannot RESET MASTER", + ErrIndexRebuild: "Failed rebuilding the index of dumped table '%-.192s'", + ErrMaster: "Error from master: '%-.64s'", + ErrMasterNetRead: "Net error reading from master", + ErrMasterNetWrite: "Net error writing to master", + ErrFtMatchingKeyNotFound: "Can't find FULLTEXT index matching the column list", + ErrLockOrActiveTransaction: "Can't execute the given command because you have active locked tables or an active transaction", + ErrUnknownSystemVariable: "Unknown system variable '%-.64s'", + ErrCrashedOnUsage: "Table '%-.192s' is marked as crashed and should be repaired", + ErrCrashedOnRepair: "Table '%-.192s' is marked as crashed and last (automatic?) repair failed", + ErrWarningNotCompleteRollback: "Some non-transactional changed tables couldn't be rolled back", + ErrTransCacheFull: "Multi-statement transaction required more than 'maxBinlogCacheSize' bytes of storage; increase this mysqld variable and try again", + ErrSlaveMustStop: "This operation cannot be performed with a running slave; run STOP SLAVE first", + ErrSlaveNotRunning: "This operation requires a running slave; configure slave and do START SLAVE", + ErrBadSlave: "The server is not configured as slave; fix in config file or with CHANGE MASTER TO", + ErrMasterInfo: "Could not initialize master info structure; more error messages can be found in the MySQL error log", + ErrSlaveThread: "Could not create slave thread; check system resources", + ErrTooManyUserConnections: "User %-.64s already has more than 'maxUserConnections' active connections", + ErrSetConstantsOnly: "You may only use constant expressions with SET", + ErrLockWaitTimeout: "Lock wait timeout exceeded; try restarting transaction", + ErrLockTableFull: "The total number of locks exceeds the lock table size", + ErrReadOnlyTransaction: "Update locks cannot be acquired during a READ UNCOMMITTED transaction", + ErrDropDBWithReadLock: "DROP DATABASE not allowed while thread is holding global read lock", + ErrCreateDBWithReadLock: "CREATE DATABASE not allowed while thread is holding global read lock", + ErrWrongArguments: "Incorrect arguments to %s", + ErrNoPermissionToCreateUser: "'%-.48s'@'%-.64s' is not allowed to create new users", + ErrUnionTablesInDifferentDir: "Incorrect table definition; all MERGE tables must be in the same database", + ErrLockDeadlock: "Deadlock found when trying to get lock; try restarting transaction", + ErrTableCantHandleFt: "The used table type doesn't support FULLTEXT indexes", + ErrCannotAddForeign: "Cannot add foreign key constraint", + ErrNoReferencedRow: "Cannot add or update a child row: a foreign key constraint fails", + ErrRowIsReferenced: "Cannot delete or update a parent row: a foreign key constraint fails", + ErrConnectToMaster: "Error connecting to master: %-.128s", + ErrQueryOnMaster: "Error running query on master: %-.128s", + ErrErrorWhenExecutingCommand: "Error when executing command %s: %-.128s", + ErrWrongUsage: "Incorrect usage of %s and %s", + ErrWrongNumberOfColumnsInSelect: "The used SELECT statements have a different number of columns", + ErrCantUpdateWithReadlock: "Can't execute the query because you have a conflicting read lock", + ErrMixingNotAllowed: "Mixing of transactional and non-transactional tables is disabled", + ErrDupArgument: "Option '%s' used twice in statement", + ErrUserLimitReached: "User '%-.64s' has exceeded the '%s' resource (current value: %d)", + ErrSpecificAccessDenied: "Access denied; you need (at least one of) the %-.128s privilege(s) for this operation", + ErrLocalVariable: "Variable '%-.64s' is a SESSION variable and can't be used with SET GLOBAL", + ErrGlobalVariable: "Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL", + ErrNoDefault: "Variable '%-.64s' doesn't have a default value", + ErrWrongValueForVar: "Variable '%-.64s' can't be set to the value of '%-.200s'", + ErrWrongTypeForVar: "Incorrect argument type to variable '%-.64s'", + ErrVarCantBeRead: "Variable '%-.64s' can only be set, not read", + ErrCantUseOptionHere: "Incorrect usage/placement of '%s'", + ErrNotSupportedYet: "This version of TiDB doesn't yet support '%s'", + ErrMasterFatalErrorReadingBinlog: "Got fatal error %d from master when reading data from binary log: '%-.320s'", + ErrSlaveIgnoredTable: "Slave SQL thread ignored the query because of replicate-*-table rules", + ErrIncorrectGlobalLocalVar: "Variable '%-.192s' is a %s variable", + ErrWrongFkDef: "Incorrect foreign key definition for '%-.192s': %s", + ErrKeyRefDoNotMatchTableRef: "Key reference and table reference don't match", + ErrOperandColumns: "Operand should contain %d column(s)", + ErrSubqueryNo1Row: "Subquery returns more than 1 row", + ErrUnknownStmtHandler: "Unknown prepared statement handler (%.*s) given to %s", + ErrCorruptHelpDB: "Help database is corrupt or does not exist", + ErrCyclicReference: "Cyclic reference on subqueries", + ErrAutoConvert: "Converting column '%s' from %s to %s", + ErrIllegalReference: "Reference '%-.64s' not supported (%s)", + ErrDerivedMustHaveAlias: "Every derived table must have its own alias", + ErrSelectReduced: "Select %d was reduced during optimization", + ErrTablenameNotAllowedHere: "Table '%s' from one of the %ss cannot be used in %s", + ErrNotSupportedAuthMode: "Client does not support authentication protocol requested by server; consider upgrading MySQL client", + ErrSpatialCantHaveNull: "All parts of a SPATIAL index must be NOT NULL", + ErrCollationCharsetMismatch: "COLLATION '%s' is not valid for CHARACTER SET '%s'", + ErrSlaveWasRunning: "Slave is already running", + ErrSlaveWasNotRunning: "Slave already has been stopped", + ErrTooBigForUncompress: "Uncompressed data size too large; the maximum size is %d (probably, length of uncompressed data was corrupted)", + ErrZlibZMem: "ZLIB: Not enough memory", + ErrZlibZBuf: "ZLIB: Not enough room in the output buffer (probably, length of uncompressed data was corrupted)", + ErrZlibZData: "ZLIB: Input data corrupted", + ErrCutValueGroupConcat: "Some rows were cut by GROUPCONCAT(%s)", + ErrWarnTooFewRecords: "Row %d doesn't contain data for all columns", + ErrWarnTooManyRecords: "Row %d was truncated; it contained more data than there were input columns", + ErrWarnNullToNotnull: "Column set to default value; NULL supplied to NOT NULL column '%s' at row %d", + ErrWarnDataOutOfRange: "Out of range value for column '%s' at row %d", + WarnDataTruncated: "Data truncated for column '%s' at row %d", + ErrWarnUsingOtherHandler: "Using storage engine %s for table '%s'", + ErrCantAggregate2collations: "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", + ErrDropUser: "Cannot drop one or more of the requested users", + ErrRevokeGrants: "Can't revoke all privileges for one or more of the requested users", + ErrCantAggregate3collations: "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", + ErrCantAggregateNcollations: "Illegal mix of collations for operation '%s'", + ErrVariableIsNotStruct: "Variable '%-.64s' is not a variable component (can't be used as XXXX.variableName)", + ErrUnknownCollation: "Unknown collation: '%-.64s'", + ErrSlaveIgnoredSslParams: "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later if MySQL slave with SSL is started", + ErrServerIsInSecureAuthMode: "Server is running in --secure-auth mode, but '%s'@'%s' has a password in the old format; please change the password to the new format", + ErrWarnFieldResolved: "Field or reference '%-.192s%s%-.192s%s%-.192s' of SELECT #%d was resolved in SELECT #%d", + ErrBadSlaveUntilCond: "Incorrect parameter or combination of parameters for START SLAVE UNTIL", + ErrMissingSkipSlave: "It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart", + ErrUntilCondIgnored: "SQL thread is not to be started so UNTIL options are ignored", + ErrWrongNameForIndex: "Incorrect index name '%-.100s'", + ErrWrongNameForCatalog: "Incorrect catalog name '%-.100s'", + ErrWarnQcResize: "Query cache failed to set size %d; new query cache size is %d", + ErrBadFtColumn: "Column '%-.192s' cannot be part of FULLTEXT index", + ErrUnknownKeyCache: "Unknown key cache '%-.100s'", + ErrWarnHostnameWontWork: "MySQL is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work", + ErrUnknownStorageEngine: "Unknown storage engine '%s'", + ErrWarnDeprecatedSyntax: "'%s' is deprecated and will be removed in a future release. Please use %s instead", + ErrNonUpdatableTable: "The target table %-.100s of the %s is not updatable", + ErrFeatureDisabled: "The '%s' feature is disabled; you need MySQL built with '%s' to have it working", + ErrOptionPreventsStatement: "The MySQL server is running with the %s option so it cannot execute this statement", + ErrDuplicatedValueInType: "Column '%-.100s' has duplicated value '%-.64s' in %s", + ErrTruncatedWrongValue: "Truncated incorrect %-.64s value: '%-.128s'", + ErrTooMuchAutoTimestampCols: "Incorrect table definition; there can be only one TIMESTAMP column with CURRENTTIMESTAMP in DEFAULT or ON UPDATE clause", + ErrInvalidOnUpdate: "Invalid ON UPDATE clause for '%-.192s' column", + ErrUnsupportedPs: "This command is not supported in the prepared statement protocol yet", + ErrGetErrmsg: "Got error %d '%-.100s' from %s", + ErrGetTemporaryErrmsg: "Got temporary error %d '%-.100s' from %s", + ErrUnknownTimeZone: "Unknown or incorrect time zone: '%-.64s'", + ErrWarnInvalidTimestamp: "Invalid TIMESTAMP value in column '%s' at row %d", + ErrInvalidCharacterString: "Invalid %s character string: '%.64s'", + ErrWarnAllowedPacketOverflowed: "Result of %s() was larger than max_allowed_packet (%d) - truncated", + ErrConflictingDeclarations: "Conflicting declarations: '%s%s' and '%s%s'", + ErrSpNoRecursiveCreate: "Can't create a %s from within another stored routine", + ErrSpAlreadyExists: "%s %s already exists", + ErrSpDoesNotExist: "%s %s does not exist", + ErrSpDropFailed: "Failed to DROP %s %s", + ErrSpStoreFailed: "Failed to CREATE %s %s", + ErrSpLilabelMismatch: "%s with no matching label: %s", + ErrSpLabelRedefine: "Redefining label %s", + ErrSpLabelMismatch: "End-label %s without match", + ErrSpUninitVar: "Referring to uninitialized variable %s", + ErrSpBadselect: "PROCEDURE %s can't return a result set in the given context", + ErrSpBadreturn: "RETURN is only allowed in a FUNCTION", + ErrSpBadstatement: "%s is not allowed in stored procedures", + ErrUpdateLogDeprecatedIgnored: "The update log is deprecated and replaced by the binary log; SET SQLLOGUPDATE has been ignored.", + ErrUpdateLogDeprecatedTranslated: "The update log is deprecated and replaced by the binary log; SET SQLLOGUPDATE has been translated to SET SQLLOGBIN.", + ErrQueryInterrupted: "Query execution was interrupted", + ErrSpWrongNoOfArgs: "Incorrect number of arguments for %s %s; expected %d, got %d", + ErrSpCondMismatch: "Undefined CONDITION: %s", + ErrSpNoreturn: "No RETURN found in FUNCTION %s", + ErrSpNoreturnend: "FUNCTION %s ended without RETURN", + ErrSpBadCursorQuery: "Cursor statement must be a SELECT", + ErrSpBadCursorSelect: "Cursor SELECT must not have INTO", + ErrSpCursorMismatch: "Undefined CURSOR: %s", + ErrSpCursorAlreadyOpen: "Cursor is already open", + ErrSpCursorNotOpen: "Cursor is not open", + ErrSpUndeclaredVar: "Undeclared variable: %s", + ErrSpWrongNoOfFetchArgs: "Incorrect number of FETCH variables", + ErrSpFetchNoData: "No data - zero rows fetched, selected, or processed", + ErrSpDupParam: "Duplicate parameter: %s", + ErrSpDupVar: "Duplicate variable: %s", + ErrSpDupCond: "Duplicate condition: %s", + ErrSpDupCurs: "Duplicate cursor: %s", + ErrSpCantAlter: "Failed to ALTER %s %s", + ErrSpSubselectNyi: "Subquery value not supported", + ErrStmtNotAllowedInSfOrTrg: "%s is not allowed in stored function or trigger", + ErrSpVarcondAfterCurshndlr: "Variable or condition declaration after cursor or handler declaration", + ErrSpCursorAfterHandler: "Cursor declaration after handler declaration", + ErrSpCaseNotFound: "Case not found for CASE statement", + ErrFparserTooBigFile: "Configuration file '%-.192s' is too big", + ErrFparserBadHeader: "Malformed file type header in file '%-.192s'", + ErrFparserEOFInComment: "Unexpected end of file while parsing comment '%-.200s'", + ErrFparserErrorInParameter: "Error while parsing parameter '%-.192s' (line: '%-.192s')", + ErrFparserEOFInUnknownParameter: "Unexpected end of file while skipping unknown parameter '%-.192s'", + ErrViewNoExplain: "EXPLAIN/SHOW can not be issued; lacking privileges for underlying table", + ErrFrmUnknownType: "File '%-.192s' has unknown type '%-.64s' in its header", + ErrWrongObject: "'%-.192s.%-.192s' is not %s", + ErrNonupdateableColumn: "Column '%-.192s' is not updatable", + ErrViewSelectDerived: "View's SELECT contains a subquery in the FROM clause", + ErrViewSelectClause: "View's SELECT contains a '%s' clause", + ErrViewSelectVariable: "View's SELECT contains a variable or parameter", + ErrViewSelectTmptable: "View's SELECT refers to a temporary table '%-.192s'", + ErrViewWrongList: "View's SELECT and view's field list have different column counts", + ErrWarnViewMerge: "View merge algorithm can't be used here for now (assumed undefined algorithm)", + ErrWarnViewWithoutKey: "View being updated does not have complete key of underlying table in it", + ErrViewInvalid: "View '%-.192s.%-.192s' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them", + ErrSpNoDropSp: "Can't drop or alter a %s from within another stored routine", + ErrSpGotoInHndlr: "GOTO is not allowed in a stored procedure handler", + ErrTrgAlreadyExists: "Trigger already exists", + ErrTrgDoesNotExist: "Trigger does not exist", + ErrTrgOnViewOrTempTable: "Trigger's '%-.192s' is view or temporary table", + ErrTrgCantChangeRow: "Updating of %s row is not allowed in %strigger", + ErrTrgNoSuchRowInTrg: "There is no %s row in %s trigger", + ErrNoDefaultForField: "Field '%-.192s' doesn't have a default value", + ErrDivisionByZero: "Division by 0", + ErrTruncatedWrongValueForField: "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %d", + ErrIllegalValueForType: "Illegal %s '%-.192s' value found during parsing", + ErrViewNonupdCheck: "CHECK OPTION on non-updatable view '%-.192s.%-.192s'", + ErrViewCheckFailed: "CHECK OPTION failed '%-.192s.%-.192s'", + ErrProcaccessDenied: "%-.16s command denied to user '%-.48s'@'%-.64s' for routine '%-.192s'", + ErrRelayLogFail: "Failed purging old relay logs: %s", + ErrPasswdLength: "Password hash should be a %d-digit hexadecimal number", + ErrUnknownTargetBinlog: "Target log not found in binlog index", + ErrIoErrLogIndexRead: "I/O error reading log index file", + ErrBinlogPurgeProhibited: "Server configuration does not permit binlog purge", + ErrFseekFail: "Failed on fseek()", + ErrBinlogPurgeFatalErr: "Fatal error during log purge", + ErrLogInUse: "A purgeable log is in use, will not purge", + ErrLogPurgeUnknownErr: "Unknown error during log purge", + ErrRelayLogInit: "Failed initializing relay log position: %s", + ErrNoBinaryLogging: "You are not using binary logging", + ErrReservedSyntax: "The '%-.64s' syntax is reserved for purposes internal to the MySQL server", + ErrWsasFailed: "WSAStartup Failed", + ErrDiffGroupsProc: "Can't handle procedures with different groups yet", + ErrNoGroupForProc: "Select must have a group with this procedure", + ErrOrderWithProc: "Can't use ORDER clause with this procedure", + ErrLoggingProhibitChangingOf: "Binary logging and replication forbid changing the global server %s", + ErrNoFileMapping: "Can't map file: %-.200s, errno: %d", + ErrWrongMagic: "Wrong magic in %-.64s", + ErrPsManyParam: "Prepared statement contains too many placeholders", + ErrKeyPart0: "Key part '%-.192s' length cannot be 0", + ErrViewChecksum: "View text checksum failed", + ErrViewMultiupdate: "Can not modify more than one base table through a join view '%-.192s.%-.192s'", + ErrViewNoInsertFieldList: "Can not insert into join view '%-.192s.%-.192s' without fields list", + ErrViewDeleteMergeView: "Can not delete from join view '%-.192s.%-.192s'", + ErrCannotUser: "Operation %s failed for %.256s", + ErrXaerNota: "XAERNOTA: Unknown XID", + ErrXaerInval: "XAERINVAL: Invalid arguments (or unsupported command)", + ErrXaerRmfail: "XAERRMFAIL: The command cannot be executed when global transaction is in the %.64s state", + ErrXaerOutside: "XAEROUTSIDE: Some work is done outside global transaction", + ErrXaerRmerr: "XAERRMERR: Fatal error occurred in the transaction branch - check your data for consistency", + ErrXaRbrollback: "XARBROLLBACK: Transaction branch was rolled back", + ErrNonexistingProcGrant: "There is no such grant defined for user '%-.48s' on host '%-.64s' on routine '%-.192s'", + ErrProcAutoGrantFail: "Failed to grant EXECUTE and ALTER ROUTINE privileges", + ErrProcAutoRevokeFail: "Failed to revoke all privileges to dropped routine", + ErrDataTooLong: "Data too long for column '%s' at row %d", + ErrSpBadSQLstate: "Bad SQLSTATE: '%s'", + ErrStartup: "%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d %s", + ErrLoadFromFixedSizeRowsToVar: "Can't load value from file with fixed size rows to variable", + ErrCantCreateUserWithGrant: "You are not allowed to create a user with GRANT", + ErrWrongValueForType: "Incorrect %-.32s value: '%-.128s' for function %-.32s", + ErrTableDefChanged: "Table definition has changed, please retry transaction", + ErrSpDupHandler: "Duplicate handler declared in the same block", + ErrSpNotVarArg: "OUT or INOUT argument %d for routine %s is not a variable or NEW pseudo-variable in BEFORE trigger", + ErrSpNoRetset: "Not allowed to return a result set from a %s", + ErrCantCreateGeometryObject: "Cannot get geometry object from data you send to the GEOMETRY field", + ErrFailedRoutineBreakBinlog: "A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes", + ErrBinlogUnsafeRoutine: "This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe logBinTrustFunctionCreators variable)", + ErrBinlogCreateRoutineNeedSuper: "You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe logBinTrustFunctionCreators variable)", + ErrExecStmtWithOpenCursor: "You can't execute a prepared statement which has an open cursor associated with it. Reset the statement to re-execute it.", + ErrStmtHasNoOpenCursor: "The statement (%d) has no open cursor.", + ErrCommitNotAllowedInSfOrTrg: "Explicit or implicit commit is not allowed in stored function or trigger.", + ErrNoDefaultForViewField: "Field of view '%-.192s.%-.192s' underlying table doesn't have a default value", + ErrSpNoRecursion: "Recursive stored functions and triggers are not allowed.", + ErrTooBigScale: "Too big scale %d specified for column '%-.192s'. Maximum is %d.", + ErrTooBigPrecision: "Too big precision %d specified for column '%-.192s'. Maximum is %d.", + ErrMBiggerThanD: "For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.192s').", + ErrWrongLockOfSystemTable: "You can't combine write-locking of system tables with other tables or lock types", + ErrConnectToForeignDataSource: "Unable to connect to foreign data source: %.64s", + ErrQueryOnForeignDataSource: "There was a problem processing the query on the foreign data source. Data source : %-.64s", + ErrForeignDataSourceDoesntExist: "The foreign data source you are trying to reference does not exist. Data source : %-.64s", + ErrForeignDataStringInvalidCantCreate: "Can't create federated table. The data source connection string '%-.64s' is not in the correct format", + ErrForeignDataStringInvalid: "The data source connection string '%-.64s' is not in the correct format", + ErrCantCreateFederatedTable: "Can't create federated table. Foreign data src : %-.64s", + ErrTrgInWrongSchema: "Trigger in wrong schema", + ErrStackOverrunNeedMore: "Thread stack overrun: %d bytes used of a %d byte stack, and %d bytes needed. Use 'mysqld --threadStack=#' to specify a bigger stack.", + ErrTooLongBody: "Routine body for '%-.100s' is too long", + ErrWarnCantDropDefaultKeycache: "Cannot drop default keycache", + ErrTooBigDisplaywidth: "Display width out of range for column '%-.192s' (max = %d)", + ErrXaerDupid: "XAERDUPID: The XID already exists", + ErrDatetimeFunctionOverflow: "Datetime function: %-.32s field overflow", + ErrCantUpdateUsedTableInSfOrTrg: "Can't update table '%-.192s' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.", + ErrViewPreventUpdate: "The definition of table '%-.192s' prevents operation %.192s on table '%-.192s'.", + ErrPsNoRecursion: "The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner", + ErrSpCantSetAutocommit: "Not allowed to set autocommit from a stored function or trigger", + ErrMalformedDefiner: "Definer is not fully qualified", + ErrViewFrmNoUser: "View '%-.192s'.'%-.192s' has no definer information (old table format). Current user is used as definer. Please recreate the view!", + ErrViewOtherUser: "You need the SUPER privilege for creation view with '%-.192s'@'%-.192s' definer", + ErrNoSuchUser: "The user specified as a definer ('%-.64s'@'%-.64s') does not exist", + ErrForbidSchemaChange: "Changing schema from '%-.192s' to '%-.192s' is not allowed.", + ErrRowIsReferenced2: "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)", + ErrNoReferencedRow2: "Cannot add or update a child row: a foreign key constraint fails (%.192s)", + ErrSpBadVarShadow: "Variable '%-.64s' must be quoted with `...`, or renamed", + ErrTrgNoDefiner: "No definer attribute for trigger '%-.192s'.'%-.192s'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.", + ErrOldFileFormat: "'%-.192s' has an old format, you should re-create the '%s' object(s)", + ErrSpRecursionLimit: "Recursive limit %d (as set by the maxSpRecursionDepth variable) was exceeded for routine %.192s", + ErrSpProcTableCorrupt: "Failed to load routine %-.192s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)", + ErrSpWrongName: "Incorrect routine name '%-.192s'", + ErrTableNeedsUpgrade: "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\"", + ErrSpNoAggregate: "AGGREGATE is not supported for stored functions", + ErrMaxPreparedStmtCountReached: "Can't create more than maxPreparedStmtCount statements (current value: %d)", + ErrViewRecursive: "`%-.192s`.`%-.192s` contains view recursion", + ErrNonGroupingFieldUsed: "Non-grouping field '%-.192s' is used in %-.64s clause", + ErrTableCantHandleSpkeys: "The used table type doesn't support SPATIAL indexes", + ErrNoTriggersOnSystemSchema: "Triggers can not be created on system tables", + ErrRemovedSpaces: "Leading spaces are removed from name '%s'", + ErrAutoincReadFailed: "Failed to read auto-increment value from storage engine", + ErrUsername: "user name", + ErrHostname: "host name", + ErrWrongStringLength: "String '%-.70s' is too long for %s (should be no longer than %d)", + ErrNonInsertableTable: "The target table %-.100s of the %s is not insertable-into", + ErrAdminWrongMrgTable: "Table '%-.64s' is differently defined or of non-MyISAM type or doesn't exist", + ErrTooHighLevelOfNestingForSelect: "Too high level of nesting for select", + ErrNameBecomesEmpty: "Name '%-.64s' has become ''", + ErrAmbiguousFieldTerm: "First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY", + ErrForeignServerExists: "The foreign server, %s, you are trying to create already exists.", + ErrForeignServerDoesntExist: "The foreign server name you are trying to reference does not exist. Data source : %-.64s", + ErrIllegalHaCreateOption: "Table storage engine '%-.64s' does not support the create option '%.64s'", + ErrPartitionRequiresValues: "Syntax : %-.64s PARTITIONING requires definition of VALUES %-.64s for each partition", + ErrPartitionWrongValues: "Only %-.64s PARTITIONING can use VALUES %-.64s in partition definition", + ErrPartitionMaxvalue: "MAXVALUE can only be used in last partition definition", + ErrPartitionSubpartition: "Subpartitions can only be hash partitions and by key", + ErrPartitionSubpartMix: "Must define subpartitions on all partitions if on one partition", + ErrPartitionWrongNoPart: "Wrong number of partitions defined, mismatch with previous setting", + ErrPartitionWrongNoSubpart: "Wrong number of subpartitions defined, mismatch with previous setting", + ErrWrongExprInPartitionFunc: "Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed", + ErrNoConstExprInRangeOrList: "Expression in RANGE/LIST VALUES must be constant", + ErrFieldNotFoundPart: "Field in list of fields for partition function not found in table", + ErrListOfFieldsOnlyInHash: "List of fields is only allowed in KEY partitions", + ErrInconsistentPartitionInfo: "The partition info in the frm file is not consistent with what can be written into the frm file", + ErrPartitionFuncNotAllowed: "The %-.192s function returns the wrong type", + ErrPartitionsMustBeDefined: "For %-.64s partitions each partition must be defined", + ErrRangeNotIncreasing: "VALUES LESS THAN value must be strictly increasing for each partition", + ErrInconsistentTypeOfFunctions: "VALUES value must be of same type as partition function", + ErrMultipleDefConstInListPart: "Multiple definition of same constant in list partitioning", + ErrPartitionEntry: "Partitioning can not be used stand-alone in query", + ErrMixHandler: "The mix of handlers in the partitions is not allowed in this version of MySQL", + ErrPartitionNotDefined: "For the partitioned engine it is necessary to define all %-.64s", + ErrTooManyPartitions: "Too many partitions (including subpartitions) were defined", + ErrSubpartition: "It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning", + ErrCantCreateHandlerFile: "Failed to create specific handler file", + ErrBlobFieldInPartFunc: "A BLOB field is not allowed in partition function", + ErrUniqueKeyNeedAllFieldsInPf: "A %-.192s must include all columns in the table's partitioning function", + ErrNoParts: "Number of %-.64s = 0 is not an allowed value", + ErrPartitionMgmtOnNonpartitioned: "Partition management on a not partitioned table is not possible", + ErrForeignKeyOnPartitioned: "Foreign key clause is not yet supported in conjunction with partitioning", + ErrDropPartitionNonExistent: "Error in list of partitions to %-.64s", + ErrDropLastPartition: "Cannot remove all partitions, use DROP TABLE instead", + ErrCoalesceOnlyOnHashPartition: "COALESCE PARTITION can only be used on HASH/KEY partitions", + ErrReorgHashOnlyOnSameNo: "REORGANIZE PARTITION can only be used to reorganize partitions not to change their numbers", + ErrReorgNoParam: "REORGANIZE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs", + ErrOnlyOnRangeListPartition: "%-.64s PARTITION can only be used on RANGE/LIST partitions", + ErrAddPartitionSubpart: "Trying to Add partition(s) with wrong number of subpartitions", + ErrAddPartitionNoNewPartition: "At least one partition must be added", + ErrCoalescePartitionNoPartition: "At least one partition must be coalesced", + ErrReorgPartitionNotExist: "More partitions to reorganize than there are partitions", + ErrSameNamePartition: "Duplicate partition name %-.192s", + ErrNoBinlog: "It is not allowed to shut off binlog on this command", + ErrConsecutiveReorgPartitions: "When reorganizing a set of partitions they must be in consecutive order", + ErrReorgOutsideRange: "Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range", + ErrPartitionFunctionFailure: "Partition function not supported in this version for this handler", + ErrPartState: "Partition state cannot be defined from CREATE/ALTER TABLE", + ErrLimitedPartRange: "The %-.64s handler only supports 32 bit integers in VALUES", + ErrPluginIsNotLoaded: "Plugin '%-.192s' is not loaded", + ErrWrongValue: "Incorrect %-.32s value: '%-.128s'", + ErrNoPartitionForGivenValue: "Table has no partition for value %-.64s", + ErrFilegroupOptionOnlyOnce: "It is not allowed to specify %s more than once", + ErrCreateFilegroupFailed: "Failed to create %s", + ErrDropFilegroupFailed: "Failed to drop %s", + ErrTablespaceAutoExtend: "The handler doesn't support autoextend of tablespaces", + ErrWrongSizeNumber: "A size parameter was incorrectly specified, either number or on the form 10M", + ErrSizeOverflow: "The size number was correct but we don't allow the digit part to be more than 2 billion", + ErrAlterFilegroupFailed: "Failed to alter: %s", + ErrBinlogRowLoggingFailed: "Writing one row to the row-based binary log failed", + ErrBinlogRowWrongTableDef: "Table definition on master and slave does not match: %s", + ErrBinlogRowRbrToSbr: "Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events", + ErrEventAlreadyExists: "Event '%-.192s' already exists", + ErrEventStoreFailed: "Failed to store event %s. Error code %d from storage engine.", + ErrEventDoesNotExist: "Unknown event '%-.192s'", + ErrEventCantAlter: "Failed to alter event '%-.192s'", + ErrEventDropFailed: "Failed to drop %s", + ErrEventIntervalNotPositiveOrTooBig: "INTERVAL is either not positive or too big", + ErrEventEndsBeforeStarts: "ENDS is either invalid or before STARTS", + ErrEventExecTimeInThePast: "Event execution time is in the past. Event has been disabled", + ErrEventOpenTableFailed: "Failed to open mysql.event", + ErrEventNeitherMExprNorMAt: "No datetime expression provided", + ErrObsoleteColCountDoesntMatchCorrupted: "Column count of mysql.%s is wrong. Expected %d, found %d. The table is probably corrupted", + ErrObsoleteCannotLoadFromTable: "Cannot load from mysql.%s. The table is probably corrupted", + ErrEventCannotDelete: "Failed to delete the event from mysql.event", + ErrEventCompile: "Error during compilation of event's body", + ErrEventSameName: "Same old and new event name", + ErrEventDataTooLong: "Data for column '%s' too long", + ErrDropIndexFk: "Cannot drop index '%-.192s': needed in a foreign key constraint", + ErrWarnDeprecatedSyntaxWithVer: "The syntax '%s' is deprecated and will be removed in MySQL %s. Please use %s instead", + ErrCantWriteLockLogTable: "You can't write-lock a log table. Only read access is possible", + ErrCantLockLogTable: "You can't use locks with log tables.", + ErrForeignDuplicateKeyOldUnused: "Upholding foreign key constraints for table '%.192s', entry '%-.192s', key %d would lead to a duplicate entry", + ErrColCountDoesntMatchPleaseUpdate: "Column count of mysql.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use mysqlUpgrade to fix this error.", + ErrTempTablePreventsSwitchOutOfRbr: "Cannot switch out of the row-based binary log format when the session has open temporary tables", + ErrStoredFunctionPreventsSwitchBinlogFormat: "Cannot change the binary logging format inside a stored function or trigger", + ErrNdbCantSwitchBinlogFormat: "The NDB cluster engine does not support changing the binlog format on the fly yet", + ErrPartitionNoTemporary: "Cannot create temporary table with partitions", + ErrPartitionConstDomain: "Partition constant is out of partition function domain", + ErrPartitionFunctionIsNotAllowed: "This partition function is not allowed", + ErrDdlLog: "Error in DDL log", + ErrNullInValuesLessThan: "Not allowed to use NULL value in VALUES LESS THAN", + ErrWrongPartitionName: "Incorrect partition name", + ErrCantChangeTxCharacteristics: "Transaction characteristics can't be changed while a transaction is in progress", + ErrDupEntryAutoincrementCase: "ALTER TABLE causes autoIncrement resequencing, resulting in duplicate entry '%-.192s' for key '%-.192s'", + ErrEventModifyQueue: "Internal scheduler error %d", + ErrEventSetVar: "Error during starting/stopping of the scheduler. Error code %d", + ErrPartitionMerge: "Engine cannot be used in partitioned tables", + ErrCantActivateLog: "Cannot activate '%-.64s' log", + ErrRbrNotAvailable: "The server was not built with row-based replication", + ErrBase64Decode: "Decoding of base64 string failed", + ErrEventRecursionForbidden: "Recursion of EVENT DDL statements is forbidden when body is present", + ErrEventsDB: "Cannot proceed because system tables used by Event Scheduler were found damaged at server start", + ErrOnlyIntegersAllowed: "Only integers allowed as number here", + ErrUnsuportedLogEngine: "This storage engine cannot be used for log tables\"", + ErrBadLogStatement: "You cannot '%s' a log table if logging is enabled", + ErrCantRenameLogTable: "Cannot rename '%s'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to '%s'", + ErrWrongParamcountToNativeFct: "Incorrect parameter count in the call to native function '%-.192s'", + ErrWrongParametersToNativeFct: "Incorrect parameters in the call to native function '%-.192s'", + ErrWrongParametersToStoredFct: "Incorrect parameters in the call to stored function '%-.192s'", + ErrNativeFctNameCollision: "This function '%-.192s' has the same name as a native function", + ErrDupEntryWithKeyName: "Duplicate entry '%-.64s' for key '%-.192s'", + ErrBinlogPurgeEmFile: "Too many files opened, please execute the command again", + ErrEventCannotCreateInThePast: "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.", + ErrEventCannotAlterInThePast: "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future.", + ErrSlaveIncident: "The incident %s occurred on the master. Message: %-.64s", + ErrNoPartitionForGivenValueSilent: "Table has no partition for some existing values", + ErrBinlogUnsafeStatement: "Unsafe statement written to the binary log using statement format since BINLOGFORMAT = STATEMENT. %s", + ErrSlaveFatal: "Fatal : %s", + ErrSlaveRelayLogReadFailure: "Relay log read failure: %s", + ErrSlaveRelayLogWriteFailure: "Relay log write failure: %s", + ErrSlaveCreateEventFailure: "Failed to create %s", + ErrSlaveMasterComFailure: "Master command %s failed: %s", + ErrBinlogLoggingImpossible: "Binary logging not possible. Message: %s", + ErrViewNoCreationCtx: "View `%-.64s`.`%-.64s` has no creation context", + ErrViewInvalidCreationCtx: "Creation context of view `%-.64s`.`%-.64s' is invalid", + ErrSrInvalidCreationCtx: "Creation context of stored routine `%-.64s`.`%-.64s` is invalid", + ErrTrgCorruptedFile: "Corrupted TRG file for table `%-.64s`.`%-.64s`", + ErrTrgNoCreationCtx: "Triggers for table `%-.64s`.`%-.64s` have no creation context", + ErrTrgInvalidCreationCtx: "Trigger creation context of table `%-.64s`.`%-.64s` is invalid", + ErrEventInvalidCreationCtx: "Creation context of event `%-.64s`.`%-.64s` is invalid", + ErrTrgCantOpenTable: "Cannot open table for trigger `%-.64s`.`%-.64s`", + ErrCantCreateSroutine: "Cannot create stored routine `%-.64s`. Check warnings", + ErrNeverUsed: "Ambiguous slave modes combination. %s", + ErrNoFormatDescriptionEventBeforeBinlogStatement: "The BINLOG statement of type `%s` was not preceded by a format description BINLOG statement.", + ErrSlaveCorruptEvent: "Corrupted replication event was detected", + ErrLoadDataInvalidColumn: "Invalid column reference (%-.64s) in LOAD DATA", + ErrLogPurgeNoFile: "Being purged log %s was not found", + ErrXaRbtimeout: "XARBTIMEOUT: Transaction branch was rolled back: took too long", + ErrXaRbdeadlock: "XARBDEADLOCK: Transaction branch was rolled back: deadlock was detected", + ErrNeedReprepare: "Prepared statement needs to be re-prepared", + ErrDelayedNotSupported: "DELAYED option not supported for table '%-.192s'", + WarnNoMasterInfo: "The master info structure does not exist", + WarnOptionIgnored: "<%-.64s> option ignored", + WarnPluginDeleteBuiltin: "Built-in plugins cannot be deleted", + WarnPluginBusy: "Plugin is busy and will be uninstalled on shutdown", + ErrVariableIsReadonly: "%s variable '%s' is read-only. Use SET %s to assign the value", + ErrWarnEngineTransactionRollback: "Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted", + ErrSlaveHeartbeatFailure: "Unexpected master's heartbeat data: %s", + ErrSlaveHeartbeatValueOutOfRange: "The requested value for the heartbeat period is either negative or exceeds the maximum allowed (%s seconds).", + ErrNdbReplicationSchema: "Bad schema for mysql.ndbReplication table. Message: %-.64s", + ErrConflictFnParse: "Error in parsing conflict function. Message: %-.64s", + ErrExceptionsWrite: "Write to exceptions table failed. Message: %-.128s\"", + ErrTooLongTableComment: "Comment for table '%-.64s' is too long (max = %d)", + ErrTooLongFieldComment: "Comment for field '%-.64s' is too long (max = %d)", + ErrFuncInexistentNameCollision: "FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual", + ErrDatabaseName: "Database", + ErrTableName: "Table", + ErrPartitionName: "Partition", + ErrSubpartitionName: "Subpartition", + ErrTemporaryName: "Temporary", + ErrRenamedName: "Renamed", + ErrTooManyConcurrentTrxs: "Too many active concurrent transactions", + WarnNonASCIISeparatorNotImplemented: "Non-ASCII separator arguments are not fully supported", + ErrDebugSyncTimeout: "debug sync point wait timed out", + ErrDebugSyncHitLimit: "debug sync point hit limit reached", + ErrDupSignalSet: "Duplicate condition information item '%s'", + ErrSignalWarn: "Unhandled user-defined warning condition", + ErrSignalNotFound: "Unhandled user-defined not found condition", + ErrSignalException: "Unhandled user-defined exception condition", + ErrResignalWithoutActiveHandler: "RESIGNAL when handler not active", + ErrSignalBadConditionType: "SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE", + WarnCondItemTruncated: "Data truncated for condition item '%s'", + ErrCondItemTooLong: "Data too long for condition item '%s'", + ErrUnknownLocale: "Unknown locale: '%-.64s'", + ErrSlaveIgnoreServerIds: "The requested server id %d clashes with the slave startup option --replicate-same-server-id", + ErrQueryCacheDisabled: "Query cache is disabled; restart the server with queryCacheType=1 to enable it", + ErrSameNamePartitionField: "Duplicate partition field name '%-.192s'", + ErrPartitionColumnList: "Inconsistency in usage of column lists for partitioning", + ErrWrongTypeColumnValue: "Partition column values of incorrect type", + ErrTooManyPartitionFuncFields: "Too many fields in '%-.192s'", + ErrMaxvalueInValuesIn: "Cannot use MAXVALUE as value in VALUES IN", + ErrTooManyValues: "Cannot have more than one value for this type of %-.64s partitioning", + ErrRowSinglePartitionField: "Row expressions in VALUES IN only allowed for multi-field column partitioning", + ErrFieldTypeNotAllowedAsPartitionField: "Field '%-.192s' is of a not allowed type for this type of partitioning", + ErrPartitionFieldsTooLong: "The total length of the partitioning fields is too large", + ErrBinlogRowEngineAndStmtEngine: "Cannot execute statement: impossible to write to binary log since both row-incapable engines and statement-incapable engines are involved.", + ErrBinlogRowModeAndStmtEngine: "Cannot execute statement: impossible to write to binary log since BINLOGFORMAT = ROW and at least one table uses a storage engine limited to statement-based logging.", + ErrBinlogUnsafeAndStmtEngine: "Cannot execute statement: impossible to write to binary log since statement is unsafe, storage engine is limited to statement-based logging, and BINLOGFORMAT = MIXED. %s", + ErrBinlogRowInjectionAndStmtEngine: "Cannot execute statement: impossible to write to binary log since statement is in row format and at least one table uses a storage engine limited to statement-based logging.", + ErrBinlogStmtModeAndRowEngine: "Cannot execute statement: impossible to write to binary log since BINLOGFORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging.%s", + ErrBinlogRowInjectionAndStmtMode: "Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOGFORMAT = STATEMENT.", + ErrBinlogMultipleEnginesAndSelfLoggingEngine: "Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging.", + ErrBinlogUnsafeLimit: "The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.", + ErrBinlogUnsafeInsertDelayed: "The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.", + ErrBinlogUnsafeSystemTable: "The statement is unsafe because it uses the general log, slow query log, or performanceSchema table(s). This is unsafe because system tables may differ on slaves.", + ErrBinlogUnsafeAutoincColumns: "Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTOINCREMENT column. Inserted values cannot be logged correctly.", + ErrBinlogUnsafeUdf: "Statement is unsafe because it uses a UDF which may not return the same value on the slave.", + ErrBinlogUnsafeSystemVariable: "Statement is unsafe because it uses a system variable that may have a different value on the slave.", + ErrBinlogUnsafeSystemFunction: "Statement is unsafe because it uses a system function that may return a different value on the slave.", + ErrBinlogUnsafeNontransAfterTrans: "Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.", + ErrMessageAndStatement: "%s Statement: %s", + ErrSlaveConversionFailed: "Column %d of table '%-.192s.%-.192s' cannot be converted from type '%-.32s' to type '%-.32s'", + ErrSlaveCantCreateConversion: "Can't create conversion table for table '%-.192s.%-.192s'", + ErrInsideTransactionPreventsSwitchBinlogFormat: "Cannot modify @@session.binlogFormat inside a transaction", + ErrPathLength: "The path specified for %.64s is too long.", + ErrWarnDeprecatedSyntaxNoReplacement: "'%s' is deprecated and will be removed in a future release.", + ErrWrongNativeTableStructure: "Native table '%-.64s'.'%-.64s' has the wrong structure", + ErrWrongPerfSchemaUsage: "Invalid performanceSchema usage.", + ErrWarnISSkippedTable: "Table '%s'.'%s' was skipped since its definition is being modified by concurrent DDL statement", + ErrInsideTransactionPreventsSwitchBinlogDirect: "Cannot modify @@session.binlogDirectNonTransactionalUpdates inside a transaction", + ErrStoredFunctionPreventsSwitchBinlogDirect: "Cannot change the binlog direct flag inside a stored function or trigger", + ErrSpatialMustHaveGeomCol: "A SPATIAL index may only contain a geometrical type column", + ErrTooLongIndexComment: "Comment for index '%-.64s' is too long (max = %d)", + ErrLockAborted: "Wait on a lock was aborted due to a pending exclusive lock", + ErrDataOutOfRange: "%s value is out of range in '%s'", + ErrWrongSpvarTypeInLimit: "A variable of a non-integer based type in LIMIT clause", + ErrBinlogUnsafeMultipleEnginesAndSelfLoggingEngine: "Mixing self-logging and non-self-logging engines in a statement is unsafe.", + ErrBinlogUnsafeMixedStatement: "Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.", + ErrInsideTransactionPreventsSwitchSQLLogBin: "Cannot modify @@session.sqlLogBin inside a transaction", + ErrStoredFunctionPreventsSwitchSQLLogBin: "Cannot change the sqlLogBin inside a stored function or trigger", + ErrFailedReadFromParFile: "Failed to read from the .par file", + ErrValuesIsNotIntType: "VALUES value for partition '%-.64s' must have type INT", + ErrAccessDeniedNoPassword: "Access denied for user '%-.48s'@'%-.64s'", + ErrSetPasswordAuthPlugin: "SET PASSWORD has no significance for users authenticating via plugins", + ErrGrantPluginUserExists: "GRANT with IDENTIFIED WITH is illegal because the user %-.*s already exists", + ErrTruncateIllegalFk: "Cannot truncate a table referenced in a foreign key constraint (%.192s)", + ErrPluginIsPermanent: "Plugin '%s' is forcePlusPermanent and can not be unloaded", + ErrSlaveHeartbeatValueOutOfRangeMin: "The requested value for the heartbeat period is less than 1 millisecond. The value is reset to 0, meaning that heartbeating will effectively be disabled.", + ErrSlaveHeartbeatValueOutOfRangeMax: "The requested value for the heartbeat period exceeds the value of `slaveNetTimeout' seconds. A sensible value for the period should be less than the timeout.", + ErrStmtCacheFull: "Multi-row statements required more than 'maxBinlogStmtCacheSize' bytes of storage; increase this mysqld variable and try again", + ErrMultiUpdateKeyConflict: "Primary key/partition key update is not allowed since the table is updated both as '%-.192s' and '%-.192s'.", + ErrTableNeedsRebuild: "Table rebuild required. Please do \"ALTER TABLE `%-.32s` FORCE\" or dump/reload to fix it!", + WarnOptionBelowLimit: "The value of '%s' should be no less than the value of '%s'", + ErrIndexColumnTooLong: "Index column size too large. The maximum column size is %d bytes.", + ErrErrorInTriggerBody: "Trigger '%-.64s' has an error in its body: '%-.256s'", + ErrErrorInUnknownTriggerBody: "Unknown trigger has an error in its body: '%-.256s'", + ErrIndexCorrupt: "Index %s is corrupted", + ErrUndoRecordTooBig: "Undo log record is too big.", + ErrBinlogUnsafeInsertIgnoreSelect: "INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.", + ErrBinlogUnsafeInsertSelectUpdate: "INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave.", + ErrBinlogUnsafeReplaceSelect: "REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave.", + ErrBinlogUnsafeCreateIgnoreSelect: "CREATE... IGNORE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.", + ErrBinlogUnsafeCreateReplaceSelect: "CREATE... REPLACE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave.", + ErrBinlogUnsafeUpdateIgnore: "UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.", + ErrPluginNoUninstall: "Plugin '%s' is marked as not dynamically uninstallable. You have to stop the server to uninstall it.", + ErrPluginNoInstall: "Plugin '%s' is marked as not dynamically installable. You have to stop the server to install it.", + ErrBinlogUnsafeWriteAutoincSelect: "Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.", + ErrBinlogUnsafeCreateSelectAutoinc: "CREATE TABLE... SELECT... on a table with an auto-increment column is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are inserted. This order cannot be predicted and may differ on master and the slave.", + ErrBinlogUnsafeInsertTwoKeys: "INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe", + ErrTableInFkCheck: "Table is being used in foreign key check.", + ErrUnsupportedEngine: "Storage engine '%s' does not support system tables. [%s.%s]", + ErrBinlogUnsafeAutoincNotFirst: "INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.", + ErrCannotLoadFromTableV2: "Cannot load from %s.%s. The table is probably corrupted", + ErrMasterDelayValueOutOfRange: "The requested value %d for the master delay exceeds the maximum %d", + ErrOnlyFdAndRbrEventsAllowedInBinlogStatement: "Only FormatDescriptionLogEvent and row events are allowed in BINLOG statements (but %s was provided)", + ErrPartitionExchangeDifferentOption: "Non matching attribute '%-.64s' between partition and table", + ErrPartitionExchangePartTable: "Table to exchange with partition is partitioned: '%-.64s'", + ErrPartitionExchangeTempTable: "Table to exchange with partition is temporary: '%-.64s'", + ErrPartitionInsteadOfSubpartition: "Subpartitioned table, use subpartition instead of partition", + ErrUnknownPartition: "Unknown partition '%-.64s' in table '%-.64s'", + ErrTablesDifferentMetadata: "Tables have different definitions", + ErrRowDoesNotMatchPartition: "Found a row that does not match the partition", + ErrBinlogCacheSizeGreaterThanMax: "Option binlogCacheSize (%d) is greater than maxBinlogCacheSize (%d); setting binlogCacheSize equal to maxBinlogCacheSize.", + ErrWarnIndexNotApplicable: "Cannot use %-.64s access on index '%-.64s' due to type or collation conversion on field '%-.64s'", + ErrPartitionExchangeForeignKey: "Table to exchange with partition has foreign key references: '%-.64s'", + ErrNoSuchKeyValue: "Key value '%-.192s' was not found in table '%-.192s.%-.192s'", + ErrRplInfoDataTooLong: "Data for column '%s' too long", + ErrNetworkReadEventChecksumFailure: "Replication event checksum verification failed while reading from network.", + ErrBinlogReadEventChecksumFailure: "Replication event checksum verification failed while reading from a log file.", + ErrBinlogStmtCacheSizeGreaterThanMax: "Option binlogStmtCacheSize (%d) is greater than maxBinlogStmtCacheSize (%d); setting binlogStmtCacheSize equal to maxBinlogStmtCacheSize.", + ErrCantUpdateTableInCreateTableSelect: "Can't update table '%-.192s' while '%-.192s' is being created.", + ErrPartitionClauseOnNonpartitioned: "PARTITION () clause on non partitioned table", + ErrRowDoesNotMatchGivenPartitionSet: "Found a row not matching the given partition set", + ErrNoSuchPartitionunused: "partition '%-.64s' doesn't exist", + ErrChangeRplInfoRepositoryFailure: "Failure while changing the type of replication repository: %s.", + ErrWarningNotCompleteRollbackWithCreatedTempTable: "The creation of some temporary tables could not be rolled back.", + ErrWarningNotCompleteRollbackWithDroppedTempTable: "Some temporary tables were dropped, but these operations could not be rolled back.", + ErrMtsFeatureIsNotSupported: "%s is not supported in multi-threaded slave mode. %s", + ErrMtsUpdatedDBsGreaterMax: "The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata.", + ErrMtsCantParallel: "Cannot execute the current event group in the parallel mode. Encountered event %s, relay-log name %s, position %s which prevents execution of this event group in parallel mode. Reason: %s.", + ErrMtsInconsistentData: "%s", + ErrFulltextNotSupportedWithPartitioning: "FULLTEXT index is not supported for partitioned tables.", + ErrDaInvalidConditionNumber: "Invalid condition number", + ErrInsecurePlainText: "Sending passwords in plain text without SSL/TLS is extremely insecure.", + ErrInsecureChangeMaster: "Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.", + ErrForeignDuplicateKeyWithChildInfo: "Foreign key constraint for table '%.192s', record '%-.192s' would lead to a duplicate entry in table '%.192s', key '%.192s'", + ErrForeignDuplicateKeyWithoutChildInfo: "Foreign key constraint for table '%.192s', record '%-.192s' would lead to a duplicate entry in a child table", + ErrSQLthreadWithSecureSlave: "Setting authentication options is not possible when only the Slave SQL Thread is being started.", + ErrTableHasNoFt: "The table does not have FULLTEXT index to support this query", + ErrVariableNotSettableInSfOrTrigger: "The system variable %.200s cannot be set in stored functions or triggers.", + ErrVariableNotSettableInTransaction: "The system variable %.200s cannot be set when there is an ongoing transaction.", + ErrGtidNextIsNotInGtidNextList: "The system variable @@SESSION.GTIDNEXT has the value %.200s, which is not listed in @@SESSION.GTIDNEXTLIST.", + ErrCantChangeGtidNextInTransactionWhenGtidNextListIsNull: "When @@SESSION.GTIDNEXTLIST == NULL, the system variable @@SESSION.GTIDNEXT cannot change inside a transaction.", + ErrSetStatementCannotInvokeFunction: "The statement 'SET %.200s' cannot invoke a stored function.", + ErrGtidNextCantBeAutomaticIfGtidNextListIsNonNull: "The system variable @@SESSION.GTIDNEXT cannot be 'AUTOMATIC' when @@SESSION.GTIDNEXTLIST is non-NULL.", + ErrSkippingLoggedTransaction: "Skipping transaction %.200s because it has already been executed and logged.", + ErrMalformedGtidSetSpecification: "Malformed GTID set specification '%.200s'.", + ErrMalformedGtidSetEncoding: "Malformed GTID set encoding.", + ErrMalformedGtidSpecification: "Malformed GTID specification '%.200s'.", + ErrGnoExhausted: "Impossible to generate Global Transaction Identifier: the integer component reached the maximal value. Restart the server with a new serverUuid.", + ErrBadSlaveAutoPosition: "Parameters MASTERLOGFILE, MASTERLOGPOS, RELAYLOGFILE and RELAYLOGPOS cannot be set when MASTERAUTOPOSITION is active.", + ErrAutoPositionRequiresGtidModeOn: "CHANGE MASTER TO MASTERAUTOPOSITION = 1 can only be executed when @@GLOBAL.GTIDMODE = ON.", + ErrCantDoImplicitCommitInTrxWhenGtidNextIsSet: "Cannot execute statements with implicit commit inside a transaction when @@SESSION.GTIDNEXT != AUTOMATIC or @@SESSION.GTIDNEXTLIST != NULL.", + ErrGtidMode2Or3RequiresEnforceGtidConsistencyOn: "@@GLOBAL.GTIDMODE = ON or UPGRADESTEP2 requires @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1.", + ErrGtidModeRequiresBinlog: "@@GLOBAL.GTIDMODE = ON or UPGRADESTEP1 or UPGRADESTEP2 requires --log-bin and --log-slave-updates.", + ErrCantSetGtidNextToGtidWhenGtidModeIsOff: "@@SESSION.GTIDNEXT cannot be set to UUID:NUMBER when @@GLOBAL.GTIDMODE = OFF.", + ErrCantSetGtidNextToAnonymousWhenGtidModeIsOn: "@@SESSION.GTIDNEXT cannot be set to ANONYMOUS when @@GLOBAL.GTIDMODE = ON.", + ErrCantSetGtidNextListToNonNullWhenGtidModeIsOff: "@@SESSION.GTIDNEXTLIST cannot be set to a non-NULL value when @@GLOBAL.GTIDMODE = OFF.", + ErrFoundGtidEventWhenGtidModeIsOff: "Found a GtidLogEvent or PreviousGtidsLogEvent when @@GLOBAL.GTIDMODE = OFF.", + ErrGtidUnsafeNonTransactionalTable: "When @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1, updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables.", + ErrGtidUnsafeCreateSelect: "CREATE TABLE ... SELECT is forbidden when @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1.", + ErrGtidUnsafeCreateDropTemporaryTableInTransaction: "When @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1.", + ErrGtidModeCanOnlyChangeOneStepAtATime: "The value of @@GLOBAL.GTIDMODE can only change one step at a time: OFF <-> UPGRADESTEP1 <-> UPGRADESTEP2 <-> ON. Also note that this value must be stepped up or down simultaneously on all servers; see the Manual for instructions.", + ErrMasterHasPurgedRequiredGtids: "The slave is connecting using CHANGE MASTER TO MASTERAUTOPOSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.", + ErrCantSetGtidNextWhenOwningGtid: "@@SESSION.GTIDNEXT cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK.", + ErrUnknownExplainFormat: "Unknown EXPLAIN format name: '%s'", + ErrCantExecuteInReadOnlyTransaction: "Cannot execute statement in a READ ONLY transaction.", + ErrTooLongTablePartitionComment: "Comment for table partition '%-.64s' is too long (max = %d)", + ErrSlaveConfiguration: "Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave. Additional error messages can be found in the MySQL error log.", + ErrInnodbFtLimit: "InnoDB presently supports one FULLTEXT index creation at a time", + ErrInnodbNoFtTempTable: "Cannot create FULLTEXT index on temporary InnoDB table", + ErrInnodbFtWrongDocidColumn: "Column '%-.192s' is of wrong type for an InnoDB FULLTEXT index", + ErrInnodbFtWrongDocidIndex: "Index '%-.192s' is of wrong type for an InnoDB FULLTEXT index", + ErrInnodbOnlineLogTooBig: "Creating index '%-.192s' required more than 'innodbOnlineAlterLogMaxSize' bytes of modification log. Please try again.", + ErrUnknownAlterAlgorithm: "Unknown ALGORITHM '%s'", + ErrUnknownAlterLock: "Unknown LOCK type '%s'", + ErrMtsChangeMasterCantRunWithGaps: "CHANGE MASTER cannot be executed when the slave was stopped with an error or killed in MTS mode. Consider using RESET SLAVE or START SLAVE UNTIL.", + ErrMtsRecoveryFailure: "Cannot recover after SLAVE errored out in parallel execution mode. Additional error messages can be found in the MySQL error log.", + ErrMtsResetWorkers: "Cannot clean up worker info tables. Additional error messages can be found in the MySQL error log.", + ErrColCountDoesntMatchCorruptedV2: "Column count of %s.%s is wrong. Expected %d, found %d. The table is probably corrupted", + ErrSlaveSilentRetryTransaction: "Slave must silently retry current transaction", + ErrDiscardFkChecksRunning: "There is a foreign key check running on table '%-.192s'. Cannot discard the table.", + ErrTableSchemaMismatch: "Schema mismatch (%s)", + ErrTableInSystemTablespace: "Table '%-.192s' in system tablespace", + ErrIoRead: "IO Read : (%d, %s) %s", + ErrIoWrite: "IO Write : (%d, %s) %s", + ErrTablespaceMissing: "Tablespace is missing for table '%-.192s'", + ErrTablespaceExists: "Tablespace for table '%-.192s' exists. Please DISCARD the tablespace before IMPORT.", + ErrTablespaceDiscarded: "Tablespace has been discarded for table '%-.192s'", + ErrInternal: "Internal : %s", + ErrInnodbImport: "ALTER TABLE '%-.192s' IMPORT TABLESPACE failed with error %d : '%s'", + ErrInnodbIndexCorrupt: "Index corrupt: %s", + ErrInvalidYearColumnLength: "Supports only YEAR or YEAR(4) column", + ErrNotValidPassword: "Your password does not satisfy the current policy requirements", + ErrMustChangePassword: "You must SET PASSWORD before executing this statement", + ErrFkNoIndexChild: "Failed to add the foreign key constaint. Missing index for constraint '%s' in the foreign table '%s'", + ErrFkNoIndexParent: "Failed to add the foreign key constaint. Missing index for constraint '%s' in the referenced table '%s'", + ErrFkFailAddSystem: "Failed to add the foreign key constraint '%s' to system tables", + ErrFkCannotOpenParent: "Failed to open the referenced table '%s'", + ErrFkIncorrectOption: "Failed to add the foreign key constraint on table '%s'. Incorrect options in FOREIGN KEY constraint '%s'", + ErrFkDupName: "Duplicate foreign key constraint name '%s'", + ErrPasswordFormat: "The password hash doesn't have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function.", + ErrFkColumnCannotDrop: "Cannot drop column '%-.192s': needed in a foreign key constraint '%-.192s'", + ErrFkColumnCannotDropChild: "Cannot drop column '%-.192s': needed in a foreign key constraint '%-.192s' of table '%-.192s'", + ErrFkColumnNotNull: "Column '%-.192s' cannot be NOT NULL: needed in a foreign key constraint '%-.192s' SET NULL", + ErrDupIndex: "Duplicate index '%-.64s' defined on the table '%-.64s.%-.64s'. This is deprecated and will be disallowed in a future release.", + ErrFkColumnCannotChange: "Cannot change column '%-.192s': used in a foreign key constraint '%-.192s'", + ErrFkColumnCannotChangeChild: "Cannot change column '%-.192s': used in a foreign key constraint '%-.192s' of table '%-.192s'", + ErrFkCannotDeleteParent: "Cannot delete rows from table which is parent in a foreign key constraint '%-.192s' of table '%-.192s'", + ErrMalformedPacket: "Malformed communication packet.", + ErrReadOnlyMode: "Running in read-only mode", + ErrGtidNextTypeUndefinedGroup: "When @@SESSION.GTIDNEXT is set to a GTID, you must explicitly set it again after a COMMIT or ROLLBACK. If you see this error message in the slave SQL thread, it means that a table in the current transaction is transactional on the master and non-transactional on the slave. In a client connection, it means that you executed SET @@SESSION.GTIDNEXT before a transaction and forgot to set @@SESSION.GTIDNEXT to a different identifier or to 'AUTOMATIC' after COMMIT or ROLLBACK. Current @@SESSION.GTIDNEXT is '%s'.", + ErrVariableNotSettableInSp: "The system variable %.200s cannot be set in stored procedures.", + ErrCantSetGtidPurgedWhenGtidModeIsOff: "@@GLOBAL.GTIDPURGED can only be set when @@GLOBAL.GTIDMODE = ON.", + ErrCantSetGtidPurgedWhenGtidExecutedIsNotEmpty: "@@GLOBAL.GTIDPURGED can only be set when @@GLOBAL.GTIDEXECUTED is empty.", + ErrCantSetGtidPurgedWhenOwnedGtidsIsNotEmpty: "@@GLOBAL.GTIDPURGED can only be set when there are no ongoing transactions (not even in other clients).", + ErrGtidPurgedWasChanged: "@@GLOBAL.GTIDPURGED was changed from '%s' to '%s'.", + ErrGtidExecutedWasChanged: "@@GLOBAL.GTIDEXECUTED was changed from '%s' to '%s'.", + ErrBinlogStmtModeAndNoReplTables: "Cannot execute statement: impossible to write to binary log since BINLOGFORMAT = STATEMENT, and both replicated and non replicated tables are written to.", + ErrAlterOperationNotSupported: "%s is not supported for this operation. Try %s.", + ErrAlterOperationNotSupportedReason: "%s is not supported. Reason: %s. Try %s.", + ErrAlterOperationNotSupportedReasonCopy: "COPY algorithm requires a lock", + ErrAlterOperationNotSupportedReasonPartition: "Partition specific operations do not yet support LOCK/ALGORITHM", + ErrAlterOperationNotSupportedReasonFkRename: "Columns participating in a foreign key are renamed", + ErrAlterOperationNotSupportedReasonColumnType: "Cannot change column type INPLACE", + ErrAlterOperationNotSupportedReasonFkCheck: "Adding foreign keys needs foreignKeyChecks=OFF", + ErrAlterOperationNotSupportedReasonIgnore: "Creating unique indexes with IGNORE requires COPY algorithm to remove duplicate rows", + ErrAlterOperationNotSupportedReasonNopk: "Dropping a primary key is not allowed without also adding a new primary key", + ErrAlterOperationNotSupportedReasonAutoinc: "Adding an auto-increment column requires a lock", + ErrAlterOperationNotSupportedReasonHiddenFts: "Cannot replace hidden FTSDOCID with a user-visible one", + ErrAlterOperationNotSupportedReasonChangeFts: "Cannot drop or rename FTSDOCID", + ErrAlterOperationNotSupportedReasonFts: "Fulltext index creation requires a lock", + ErrSQLSlaveSkipCounterNotSettableInGtidMode: "sqlSlaveSkipCounter can not be set when the server is running with @@GLOBAL.GTIDMODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction", + ErrDupUnknownInIndex: "Duplicate entry for key '%-.192s'", + ErrIdentCausesTooLongPath: "Long database name and identifier for object resulted in path length exceeding %d characters. Path: '%s'.", + ErrAlterOperationNotSupportedReasonNotNull: "cannot silently convert NULL values, as required in this SQLMODE", + ErrMustChangePasswordLogin: "Your password has expired. To log in you must change it using a client that supports expired passwords.", + ErrRowInWrongPartition: "Found a row in wrong partition %s", + ErrGeneratedColumnFunctionIsNotAllowed: "Expression of generated column '%s' contains a disallowed function.", + ErrUnsupportedAlterInplaceOnVirtualColumn: "INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions.", + ErrWrongFKOptionForGeneratedColumn: "Cannot define foreign key with %s clause on a generated column.", + ErrBadGeneratedColumn: "The value specified for generated column '%s' in table '%s' is not allowed.", + ErrUnsupportedOnGeneratedColumn: "'%s' is not supported for generated columns.", + ErrGeneratedColumnNonPrior: "Generated column can refer only to generated columns defined prior to it.", + ErrDependentByGeneratedColumn: "Column '%s' has a generated column dependency.", + ErrGeneratedColumnRefAutoInc: "Generated column '%s' cannot refer to auto-increment column.", + ErrInvalidFieldSize: "Invalid size for column '%s'.", + ErrIncorrectType: "Incorrect type for argument %s in function %s.", + ErrInvalidJSONData: "Invalid JSON data provided to function %s: %s", + ErrInvalidJSONText: "Invalid JSON text: %-.192s", + ErrInvalidJSONPath: "Invalid JSON path expression %s.", + ErrInvalidTypeForJSON: "Invalid data type for JSON data in argument %d to function %s; a JSON string or JSON type is required.", + ErrInvalidJSONPathWildcard: "In this situation, path expressions may not contain the * and ** tokens.", + ErrInvalidJSONContainsPathType: "The second argument can only be either 'one' or 'all'.", + ErrJSONUsedAsKey: "JSON column '%-.192s' cannot be used in key specification.", + ErrJSONDocumentNULLKey: "JSON documents may not contain NULL member names.", + ErrBadUser: "User %s does not exist.", + ErrUserAlreadyExists: "User %s already exists.", + ErrInvalidJSONPathArrayCell: "A path expression is not a path to a cell in an array.", + ErrInvalidEncryptionOption: "Invalid encryption option.", + ErrWindowNoSuchWindow: "Window name '%s' is not defined.", + ErrWindowCircularityInWindowGraph: "There is a circularity in the window dependency graph.", + ErrWindowNoChildPartitioning: "A window which depends on another cannot define partitioning.", + ErrWindowNoInherentFrame: "Window '%s' has a frame definition, so cannot be referenced by another window.", + ErrWindowNoRedefineOrderBy: "Window '%s' cannot inherit '%s' since both contain an ORDER BY clause.", + ErrWindowFrameStartIllegal: "Window '%s': frame start cannot be UNBOUNDED FOLLOWING.", + ErrWindowFrameEndIllegal: "Window '%s': frame end cannot be UNBOUNDED PRECEDING.", + ErrWindowFrameIllegal: "Window '%s': frame start or end is negative, NULL or of non-integral type", + ErrWindowRangeFrameOrderType: "Window '%s' with RANGE N PRECEDING/FOLLOWING frame requires exactly one ORDER BY expression, of numeric or temporal type", + ErrWindowRangeFrameTemporalType: "Window '%s' with RANGE frame has ORDER BY expression of datetime type. Only INTERVAL bound value allowed.", + ErrWindowRangeFrameNumericType: "Window '%s' with RANGE frame has ORDER BY expression of numeric type, INTERVAL bound value not allowed.", + ErrWindowRangeBoundNotConstant: "Window '%s' has a non-constant frame bound.", + ErrWindowDuplicateName: "Window '%s' is defined twice.", + ErrWindowIllegalOrderBy: "Window '%s': ORDER BY or PARTITION BY uses legacy position indication which is not supported, use expression.", + ErrWindowInvalidWindowFuncUse: "You cannot use the window function '%s' in this context.'", + ErrWindowInvalidWindowFuncAliasUse: "You cannot use the alias '%s' of an expression containing a window function in this context.'", + ErrWindowNestedWindowFuncUseInWindowSpec: "You cannot nest a window function in the specification of window '%s'.", + ErrWindowRowsIntervalUse: "Window '%s': INTERVAL can only be used with RANGE frames.", + ErrWindowNoGroupOrderUnused: "ASC or DESC with GROUP BY isn't allowed with window functions; put ASC or DESC in ORDER BY", + ErrWindowExplainJson: "To get information about window functions use EXPLAIN FORMAT=JSON", + ErrWindowFunctionIgnoresFrame: "Window function '%s' ignores the frame clause of window '%s' and aggregates over the whole partition", + ErrRoleNotGranted: "%s is is not granted to %s", + ErrMaxExecTimeExceeded: "Query execution was interrupted, max_execution_time exceeded.", + ErrLockAcquireFailAndNoWaitSet: "Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set.", + ErrDataTruncatedFunctionalIndex: "Data truncated for functional index '%s' at row %d", + ErrDataOutOfRangeFunctionalIndex: "Value is out of range for functional index '%s' at row %d", + ErrFunctionalIndexOnJsonOrGeometryFunction: "Cannot create a functional index on a function that returns a JSON or GEOMETRY value", + ErrFunctionalIndexRefAutoIncrement: "Functional index '%s' cannot refer to an auto-increment column", + ErrCannotDropColumnFunctionalIndex: "Cannot drop column '%s' because it is used by a functional index. In order to drop the column, you must remove the functional index", + ErrFunctionalIndexPrimaryKey: "The primary key cannot be a functional index", + ErrFunctionalIndexOnLob: "Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST", + ErrFunctionalIndexFunctionIsNotAllowed: "Expression of functional index '%s' contains a disallowed function", + ErrFulltextFunctionalIndex: "Fulltext functional index is not supported", + ErrSpatialFunctionalIndex: "Spatial functional index is not supported", + ErrWrongKeyColumnFunctionalIndex: "The used storage engine cannot index the expression '%s'", + ErrFunctionalIndexOnField: "Functional index on a column is not supported. Consider using a regular index instead", + ErrFKIncompatibleColumns: "Referencing column '%s' in foreign key constraint '%s' are incompatible", + ErrFunctionalIndexRowValueIsNotAllowed: "Expression of functional index '%s' cannot refer to a row value", + ErrDependentByFunctionalIndex: "Column '%s' has a functional index dependency and cannot be dropped or renamed", + ErrInvalidJsonValueForFuncIndex: "Invalid JSON value for CAST for functional index '%s'", + ErrJsonValueOutOfRangeForFuncIndex: "Out of range JSON value for CAST for functional index '%s'", + ErrFunctionalIndexDataIsTooLong: "Data too long for functional index '%s'", + ErrFunctionalIndexNotApplicable: "Cannot use functional index '%s' due to type or collation conversion", + + // 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", + ErrSequenceRunOut: "Sequence '%-.64s.%-.64s' has run out", + ErrSequenceInvalidData: "Sequence '%-.64s.%-.64s' values are conflicting", + ErrSequenceAccessFail: "Sequence '%-.64s.%-.64s' access error", + ErrNotSequence: "'%-.64s.%-.64s' is not a SEQUENCE", + ErrUnknownSequence: "Unknown SEQUENCE: '%-.300s'", + ErrWrongInsertIntoSequence: "Wrong INSERT into a SEQUENCE. One can only do single table INSERT into a sequence object (like with mysqldump). If you want to change the SEQUENCE, use ALTER SEQUENCE instead.", + ErrSequenceInvalidTableStructure: "Sequence '%-.64s.%-.64s' table structure is invalid (%s)", + + // TiDB errors. + ErrMemExceedThreshold: "%s holds %dB memory, exceeds threshold %dB.%s", + ErrForUpdateCantRetry: "[%d] can not retry select for update statement", + ErrAdminCheckTable: "TiDB admin check table failed.", + ErrTxnTooLarge: "Transaction is too large, size: %d", + ErrWriteConflictInTiDB: "Write conflict, txnStartTS %d is stale", + ErrInvalidPluginID: "Wrong plugin id: %s, valid plugin id is [name]-[version], both name and version should not contain '-'", + ErrInvalidPluginManifest: "Cannot read plugin %s's manifest", + ErrInvalidPluginName: "Plugin load with %s but got wrong name %s", + ErrInvalidPluginVersion: "Plugin load with %s but got %s", + ErrDuplicatePlugin: "Plugin [%s] is redeclared", + ErrInvalidPluginSysVarName: "Plugin %s's sysVar %s must start with its plugin name %s", + ErrRequireVersionCheckFail: "Plugin %s require %s be %v but got %v", + ErrUnsupportedReloadPlugin: "Plugin %s isn't loaded so cannot be reloaded", + ErrUnsupportedReloadPluginVar: "Reload plugin with different sysVar is unsupported %v", + ErrTableLocked: "Table '%s' was locked in %s by %v", + ErrNotExist: "Error: key not exist", + ErrTxnRetryable: "Error: KV error safe to retry %s ", + ErrCannotSetNilValue: "can not set nil value", + ErrInvalidTxn: "invalid transaction", + ErrEntryTooLarge: "entry too large, the max entry size is %d, the size of data is %d", + ErrNotImplemented: "not implemented", + ErrInfoSchemaExpired: "Information schema is out of date: schema failed to update in 1 lease, please make sure TiDB can connect to TiKV", + ErrInfoSchemaChanged: "Information schema is changed during the execution of the statement(for example, table definition may be updated by other DDL ran in parallel). If you see this error often, try increasing `tidb_max_delta_schema_count`", + ErrBadNumber: "Bad Number", + ErrCastAsSignedOverflow: "Cast to signed converted positive out-of-range integer to it's negative complement", + ErrCastNegIntAsUnsigned: "Cast to unsigned converted negative integer to it's positive complement", + ErrInvalidYearFormat: "invalid year format", + ErrInvalidYear: "invalid year", + ErrIncorrectDatetimeValue: "Incorrect datetime value: '%s'", + ErrInvalidTimeFormat: "invalid time format: '%v'", + ErrInvalidWeekModeFormat: "invalid week mode format: '%v'", + ErrFieldGetDefaultFailed: "Field '%s' get default value fail", + ErrIndexOutBound: "Index column %s offset out of bound, offset: %d, row: %v", + ErrUnsupportedOp: "operation not supported", + ErrRowNotFound: "can not find the row: %s", + ErrTableStateCantNone: "table %s can't be in none state", + ErrColumnStateCantNone: "column %s can't be in none state", + ErrColumnStateNonPublic: "can not use non-public column", + ErrIndexStateCantNone: "index %s can't be in none state", + ErrInvalidRecordKey: "invalid record key", + ErrUnsupportedValueForVar: "variable '%s' does not yet support value: %s", + ErrUnsupportedIsolationLevel: "The isolation level '%s' is not supported. Set tidb_skip_isolation_level_check=1 to skip this error", + ErrInvalidDDLWorker: "Invalid DDL worker", + ErrUnsupportedDDLOperation: "Unsupported %s", + ErrNotOwner: "TiDB server is not a DDL owner", + ErrCantDecodeIndex: "Cannot decode index value, because %s", + ErrInvalidDDLJob: "Invalid DDL job", + ErrInvalidDDLJobFlag: "Invalid DDL job flag", + ErrWaitReorgTimeout: "Timeout waiting for data reorganization", + ErrInvalidStoreVersion: "Invalid storage current version: %d", + ErrUnknownTypeLength: "Unknown length for type %d", + ErrUnknownFractionLength: "Unknown length for type %d and fraction %d", + ErrInvalidDDLJobVersion: "Version %d of DDL job is greater than current one: %d", + ErrInvalidSplitRegionRanges: "Failed to split region ranges", + ErrReorgPanic: "Reorg worker panic", + ErrInvalidDDLState: "Invalid %s state: %v", + ErrCancelledDDLJob: "Cancelled DDL job", + ErrRepairTable: "Failed to repair table: %s", + ErrLoadPrivilege: "Load privilege table fail: %s", + ErrInvalidPrivilegeType: "unknown privilege type %s", + ErrUnknownFieldType: "unknown field type", + ErrInvalidSequence: "invalid sequence", + ErrInvalidType: "invalid type", + ErrCantGetValidID: "Cannot get a valid auto-ID when retrying the statement", + ErrCantSetToNull: "cannot set variable to null", + ErrSnapshotTooOld: "snapshot is older than GC safe point %s", + ErrInvalidTableID: "invalid TableID", + ErrInvalidAutoRandom: "Invalid auto random: %s", + ErrInvalidHashKeyFlag: "invalid encoded hash key flag", + ErrInvalidListIndex: "invalid list index", + ErrInvalidListMetaData: "invalid list meta data", + ErrWriteOnSnapshot: "write on snapshot", + ErrInvalidKey: "invalid key", + ErrInvalidIndexKey: "invalid index key", + ErrDataInConsistent: "data isn't equal", + ErrDDLJobNotFound: "DDL Job:%v not found", + ErrCancelFinishedDDLJob: "This job:%v is finished, so can't be cancelled", + ErrCannotCancelDDLJob: "This job:%v is almost finished, can't be cancelled now", + ErrUnknownAllocatorType: "Invalid allocator type", + ErrAutoRandReadFailed: "Failed to read auto-random value from storage engine", + ErrInvalidIncrementAndOffset: "Invalid auto_increment settings: auto_increment_increment: %d, auto_increment_offset: %d, both of them must be in range [1..65535]", + + ErrWarnOptimizerHintInvalidInteger: "integer value is out of range in '%s'", + ErrWarnOptimizerHintUnsupportedHint: "Optimizer hint %s is not supported by TiDB and is ignored", + ErrWarnOptimizerHintInvalidToken: "Cannot use %s '%s' (tok = %d) in an optimizer hint", + ErrWarnMemoryQuotaOverflow: "Max value of MEMORY_QUOTA is %d bytes, ignore this invalid limit", + ErrWarnOptimizerHintParseError: "Optimizer hint syntax error at %v", + + ErrSequenceUnsupportedTableOption: "Unsupported sequence table-option %s", + ErrColumnTypeUnsupportedNextValue: "Unsupported sequence default value for column type '%s'", + ErrUnsupportedType: "Unsupported type %T", + ErrAnalyzeMissIndex: "Index '%s' in field list does not exist in table '%s'", + ErrCartesianProductUnsupported: "Cartesian product is unsupported", + ErrPreparedStmtNotFound: "Prepared statement not found", + ErrWrongParamCount: "Wrong parameter count", + ErrSchemaChanged: "Schema has changed", + ErrUnknownPlan: "Unknown plan", + ErrPrepareMulti: "Can not prepare multiple statements", + ErrPrepareDDL: "Can not prepare DDL statements with parameters", + ErrResultIsEmpty: "Result is empty", + ErrBuildExecutor: "Failed to build executor", + ErrBatchInsertFail: "Batch insert failed, please clean the table and try again.", + ErrGetStartTS: "Can not get start ts", + ErrPrivilegeCheckFail: "privilege check fail", // this error message should begin lowercased to be compatible with the test + ErrInvalidWildCard: "Wildcard fields without any table name appears in wrong place", + ErrMixOfGroupFuncAndFieldsIncompatible: "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", + ErrUnsupportedSecondArgumentType: "JSON_OBJECTAGG: unsupported second argument type %v", + + // TiKV/PD errors. + ErrPDServerTimeout: "PD server timeout", + ErrTiKVServerTimeout: "TiKV server timeout", + ErrTiKVServerBusy: "TiKV server is busy", + ErrResolveLockTimeout: "Resolve lock timeout", + ErrRegionUnavailable: "Region is unavailable", + ErrGCTooEarly: "GC life time is shorter than transaction duration, transaction starts at %v, GC safe point is %v", + ErrWriteConflict: "Write conflict, txnStartTS=%d, conflictStartTS=%d, conflictCommitTS=%d, key=%s", + ErrTiKVStoreLimit: "Store token is up to the limit, store id = %d", +} diff --git a/executor/errors.go b/executor/errors.go index 801f379d1d78d..56d4957d3b826 100644 --- a/executor/errors.go +++ b/executor/errors.go @@ -14,8 +14,8 @@ package executor import ( - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" ) // Error instances. diff --git a/go.mod b/go.mod index 3b4a75d6b0871..d1a22de309847 100644 --- a/go.mod +++ b/go.mod @@ -76,3 +76,5 @@ require ( ) go 1.13 + +replace github.com/pingcap/parser => github.com/tiancaiamao/parser v0.0.0-20200311030529-dfb7d5052a8b diff --git a/go.sum b/go.sum index ce1488dfee690..ecc6fd5109a8b 100644 --- a/go.sum +++ b/go.sum @@ -344,6 +344,12 @@ github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d h1:4J9HCZVpvDmj2t github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 h1:mbAskLJ0oJfDRtkanvQPiooDH8HvJ2FBh+iKT/OmiQQ= github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU= +github.com/tiancaiamao/parser v0.0.0-20200311024545-ff0568b33c35 h1:YXdyzP76zzpthmrHX+Ly8YB6pvn55leSvWEWYbimVik= +github.com/tiancaiamao/parser v0.0.0-20200311024545-ff0568b33c35/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= +github.com/tiancaiamao/parser v0.0.0-20200311025843-81dd2ffe3349 h1:UJlvOybNbqWgHY+BotmRXi4ilzBRH6GfPlKZpP3EDKc= +github.com/tiancaiamao/parser v0.0.0-20200311025843-81dd2ffe3349/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= +github.com/tiancaiamao/parser v0.0.0-20200311030529-dfb7d5052a8b h1:F4OXYBudCSmF/KN83UBUdRuzOqrI2ts0AVQtvMbHS34= +github.com/tiancaiamao/parser v0.0.0-20200311030529-dfb7d5052a8b/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= github.com/tidwall/gjson v1.3.5/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= diff --git a/infoschema/error.go b/infoschema/error.go new file mode 100644 index 0000000000000..0da7e1cefc300 --- /dev/null +++ b/infoschema/error.go @@ -0,0 +1,70 @@ +// Copyright 2020 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package infoschema + +import ( + "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" +) + +var ( + // ErrDatabaseExists returns for database already exists. + ErrDatabaseExists = terror.ClassSchema.New(mysql.ErrDBCreateExists, mysql.MySQLErrName[mysql.ErrDBCreateExists]) + // ErrDatabaseDropExists returns for dropping a non-existent database. + ErrDatabaseDropExists = terror.ClassSchema.New(mysql.ErrDBDropExists, mysql.MySQLErrName[mysql.ErrDBDropExists]) + // ErrAccessDenied return when the user doesn't have the permission to access the table. + ErrAccessDenied = terror.ClassSchema.New(mysql.ErrAccessDenied, mysql.MySQLErrName[mysql.ErrAccessDenied]) + // ErrDatabaseNotExists returns for database not exists. + ErrDatabaseNotExists = terror.ClassSchema.New(mysql.ErrBadDB, mysql.MySQLErrName[mysql.ErrBadDB]) + // ErrTableExists returns for table already exists. + ErrTableExists = terror.ClassSchema.New(mysql.ErrTableExists, mysql.MySQLErrName[mysql.ErrTableExists]) + // ErrTableDropExists returns for dropping a non-existent table. + ErrTableDropExists = terror.ClassSchema.New(mysql.ErrBadTable, mysql.MySQLErrName[mysql.ErrBadTable]) + // ErrSequenceDropExists returns for dropping a non-exist sequence. + ErrSequenceDropExists = terror.ClassSchema.New(mysql.ErrUnknownSequence, mysql.MySQLErrName[mysql.ErrUnknownSequence]) + // ErrColumnNotExists returns for column not exists. + ErrColumnNotExists = terror.ClassSchema.New(mysql.ErrBadField, mysql.MySQLErrName[mysql.ErrBadField]) + // ErrColumnExists returns for column already exists. + ErrColumnExists = terror.ClassSchema.New(mysql.ErrDupFieldName, mysql.MySQLErrName[mysql.ErrDupFieldName]) + // ErrKeyNameDuplicate returns for index duplicate when rename index. + ErrKeyNameDuplicate = terror.ClassSchema.New(mysql.ErrDupKeyName, mysql.MySQLErrName[mysql.ErrDupKeyName]) + // ErrNonuniqTable returns when none unique tables errors. + ErrNonuniqTable = terror.ClassSchema.New(mysql.ErrNonuniqTable, mysql.MySQLErrName[mysql.ErrNonuniqTable]) + // ErrMultiplePriKey returns for multiple primary keys. + ErrMultiplePriKey = terror.ClassSchema.New(mysql.ErrMultiplePriKey, mysql.MySQLErrName[mysql.ErrMultiplePriKey]) + // ErrTooManyKeyParts returns for too many key parts. + ErrTooManyKeyParts = terror.ClassSchema.New(mysql.ErrTooManyKeyParts, mysql.MySQLErrName[mysql.ErrTooManyKeyParts]) + // ErrForeignKeyNotExists returns for foreign key not exists. + ErrForeignKeyNotExists = terror.ClassSchema.New(mysql.ErrCantDropFieldOrKey, mysql.MySQLErrName[mysql.ErrCantDropFieldOrKey]) + // ErrTableNotLockedForWrite returns for write tables when only hold the table read lock. + ErrTableNotLockedForWrite = terror.ClassSchema.New(mysql.ErrTableNotLockedForWrite, mysql.MySQLErrName[mysql.ErrTableNotLockedForWrite]) + // ErrTableNotLocked returns when session has explicitly lock tables, then visit unlocked table will return this error. + ErrTableNotLocked = terror.ClassSchema.New(mysql.ErrTableNotLocked, mysql.MySQLErrName[mysql.ErrTableNotLocked]) + // ErrTableNotExists returns for table not exists. + ErrTableNotExists = terror.ClassSchema.New(mysql.ErrNoSuchTable, mysql.MySQLErrName[mysql.ErrNoSuchTable]) + // ErrKeyNotExists returns for index not exists. + ErrKeyNotExists = terror.ClassSchema.New(mysql.ErrKeyDoesNotExist, mysql.MySQLErrName[mysql.ErrKeyDoesNotExist]) + // ErrCannotAddForeign returns for foreign key exists. + ErrCannotAddForeign = terror.ClassSchema.New(mysql.ErrCannotAddForeign, mysql.MySQLErrName[mysql.ErrCannotAddForeign]) + // ErrForeignKeyNotMatch returns for foreign key not match. + ErrForeignKeyNotMatch = terror.ClassSchema.New(mysql.ErrWrongFkDef, mysql.MySQLErrName[mysql.ErrWrongFkDef]) + // ErrIndexExists returns for index already exists. + ErrIndexExists = terror.ClassSchema.New(mysql.ErrDupIndex, mysql.MySQLErrName[mysql.ErrDupIndex]) + // ErrUserDropExists returns for dropping a non-existent user. + ErrUserDropExists = terror.ClassSchema.New(mysql.ErrBadUser, mysql.MySQLErrName[mysql.ErrBadUser]) + // ErrUserAlreadyExists return for creating a existent user. + ErrUserAlreadyExists = terror.ClassSchema.New(mysql.ErrUserAlreadyExists, mysql.MySQLErrName[mysql.ErrUserAlreadyExists]) + // ErrTableLocked returns when the table was locked by other session. + ErrTableLocked = terror.ClassSchema.New(mysql.ErrTableLocked, mysql.MySQLErrName[mysql.ErrTableLocked]) +) diff --git a/infoschema/infoschema.go b/infoschema/infoschema.go index d6667731240fb..757b8e9ce349d 100644 --- a/infoschema/infoschema.go +++ b/infoschema/infoschema.go @@ -20,7 +20,6 @@ import ( "github.com/pingcap/parser/model" "github.com/pingcap/parser/mysql" - "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" "github.com/pingcap/tidb/sessionctx" @@ -30,57 +29,6 @@ import ( "go.uber.org/zap" ) -var ( - // ErrDatabaseExists returns for database already exists. - ErrDatabaseExists = terror.ClassSchema.New(mysql.ErrDBCreateExists, mysql.MySQLErrName[mysql.ErrDBCreateExists]) - // ErrDatabaseDropExists returns for dropping a non-existent database. - ErrDatabaseDropExists = terror.ClassSchema.New(mysql.ErrDBDropExists, mysql.MySQLErrName[mysql.ErrDBDropExists]) - // ErrAccessDenied return when the user doesn't have the permission to access the table. - ErrAccessDenied = terror.ClassSchema.New(mysql.ErrAccessDenied, mysql.MySQLErrName[mysql.ErrAccessDenied]) - // ErrDatabaseNotExists returns for database not exists. - ErrDatabaseNotExists = terror.ClassSchema.New(mysql.ErrBadDB, mysql.MySQLErrName[mysql.ErrBadDB]) - // ErrTableExists returns for table already exists. - ErrTableExists = terror.ClassSchema.New(mysql.ErrTableExists, mysql.MySQLErrName[mysql.ErrTableExists]) - // ErrTableDropExists returns for dropping a non-existent table. - ErrTableDropExists = terror.ClassSchema.New(mysql.ErrBadTable, mysql.MySQLErrName[mysql.ErrBadTable]) - // ErrSequenceDropExists returns for dropping a non-exist sequence. - ErrSequenceDropExists = terror.ClassSchema.New(mysql.ErrUnknownSequence, mysql.MySQLErrName[mysql.ErrUnknownSequence]) - // ErrColumnNotExists returns for column not exists. - ErrColumnNotExists = terror.ClassSchema.New(mysql.ErrBadField, mysql.MySQLErrName[mysql.ErrBadField]) - // ErrColumnExists returns for column already exists. - ErrColumnExists = terror.ClassSchema.New(mysql.ErrDupFieldName, mysql.MySQLErrName[mysql.ErrDupFieldName]) - // ErrKeyNameDuplicate returns for index duplicate when rename index. - ErrKeyNameDuplicate = terror.ClassSchema.New(mysql.ErrDupKeyName, mysql.MySQLErrName[mysql.ErrDupKeyName]) - // ErrNonuniqTable returns when none unique tables errors. - ErrNonuniqTable = terror.ClassSchema.New(mysql.ErrNonuniqTable, mysql.MySQLErrName[mysql.ErrNonuniqTable]) - // ErrMultiplePriKey returns for multiple primary keys. - ErrMultiplePriKey = terror.ClassSchema.New(mysql.ErrMultiplePriKey, mysql.MySQLErrName[mysql.ErrMultiplePriKey]) - // ErrTooManyKeyParts returns for too many key parts. - ErrTooManyKeyParts = terror.ClassSchema.New(mysql.ErrTooManyKeyParts, mysql.MySQLErrName[mysql.ErrTooManyKeyParts]) - // ErrForeignKeyNotExists returns for foreign key not exists. - ErrForeignKeyNotExists = terror.ClassSchema.New(mysql.ErrCantDropFieldOrKey, mysql.MySQLErrName[mysql.ErrCantDropFieldOrKey]) - // ErrTableNotLockedForWrite returns for write tables when only hold the table read lock. - ErrTableNotLockedForWrite = terror.ClassSchema.New(mysql.ErrTableNotLockedForWrite, mysql.MySQLErrName[mysql.ErrTableNotLockedForWrite]) - // ErrTableNotLocked returns when session has explicitly lock tables, then visit unlocked table will return this error. - ErrTableNotLocked = terror.ClassSchema.New(mysql.ErrTableNotLocked, mysql.MySQLErrName[mysql.ErrTableNotLocked]) - // ErrTableNotExists returns for table not exists. - ErrTableNotExists = terror.ClassSchema.New(mysql.ErrNoSuchTable, mysql.MySQLErrName[mysql.ErrNoSuchTable]) - // ErrKeyNotExists returns for index not exists. - ErrKeyNotExists = terror.ClassSchema.New(mysql.ErrKeyDoesNotExist, mysql.MySQLErrName[mysql.ErrKeyDoesNotExist]) - // ErrCannotAddForeign returns for foreign key exists. - ErrCannotAddForeign = terror.ClassSchema.New(mysql.ErrCannotAddForeign, mysql.MySQLErrName[mysql.ErrCannotAddForeign]) - // ErrForeignKeyNotMatch returns for foreign key not match. - ErrForeignKeyNotMatch = terror.ClassSchema.New(mysql.ErrWrongFkDef, mysql.MySQLErrName[mysql.ErrWrongFkDef]) - // ErrIndexExists returns for index already exists. - ErrIndexExists = terror.ClassSchema.New(mysql.ErrDupIndex, mysql.MySQLErrName[mysql.ErrDupIndex]) - // ErrUserDropExists returns for dropping a non-existent user. - ErrUserDropExists = terror.ClassSchema.New(mysql.ErrBadUser, mysql.MySQLErrName[mysql.ErrBadUser]) - // ErrUserAlreadyExists return for creating a existent user. - ErrUserAlreadyExists = terror.ClassSchema.New(mysql.ErrUserAlreadyExists, mysql.MySQLErrName[mysql.ErrUserAlreadyExists]) - // ErrTableLocked returns when the table was locked by other session. - ErrTableLocked = terror.ClassSchema.New(mysql.ErrTableLocked, mysql.MySQLErrName[mysql.ErrTableLocked]) -) - // InfoSchema is the interface used to retrieve the schema information. // It works as a in memory cache and doesn't handle any schema change. // InfoSchema is read-only, and the returned value is a copy. diff --git a/kv/error.go b/kv/error.go index 2f1fc5220e7e9..ca61eeda89173 100644 --- a/kv/error.go +++ b/kv/error.go @@ -14,8 +14,8 @@ package kv import ( - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" ) // TxnRetryableMark is used to uniform the commit error messages which could retry the transaction. diff --git a/meta/autoid/errors.go b/meta/autoid/errors.go index 822facd535057..68d7b4850417c 100644 --- a/meta/autoid/errors.go +++ b/meta/autoid/errors.go @@ -14,8 +14,8 @@ package autoid import ( - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" ) // Error instances. diff --git a/planner/core/errors.go b/planner/core/errors.go index 93b84f05e0ee6..2b836dc4c45bd 100644 --- a/planner/core/errors.go +++ b/planner/core/errors.go @@ -14,8 +14,8 @@ package core import ( - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" ) // error definitions. diff --git a/plugin/errors.go b/plugin/errors.go index 1fa05a13165ab..a0f4a792f89d3 100644 --- a/plugin/errors.go +++ b/plugin/errors.go @@ -14,16 +14,16 @@ package plugin import ( - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + "github.com/pingcap/tidb/errno" ) var ( - errInvalidPluginID = terror.ClassPlugin.NewStd(mysql.ErrInvalidPluginID) - errInvalidPluginManifest = terror.ClassPlugin.NewStd(mysql.ErrInvalidPluginManifest) - errInvalidPluginName = terror.ClassPlugin.NewStd(mysql.ErrInvalidPluginName) - errInvalidPluginVersion = terror.ClassPlugin.NewStd(mysql.ErrInvalidPluginVersion) - errDuplicatePlugin = terror.ClassPlugin.NewStd(mysql.ErrDuplicatePlugin) - errInvalidPluginSysVarName = terror.ClassPlugin.NewStd(mysql.ErrInvalidPluginSysVarName) - errRequireVersionCheckFail = terror.ClassPlugin.NewStd(mysql.ErrRequireVersionCheckFail) + errInvalidPluginID = terror.ClassPlugin.NewStd(errno.ErrInvalidPluginID) + errInvalidPluginManifest = terror.ClassPlugin.NewStd(errno.ErrInvalidPluginManifest) + errInvalidPluginName = terror.ClassPlugin.NewStd(errno.ErrInvalidPluginName) + errInvalidPluginVersion = terror.ClassPlugin.NewStd(errno.ErrInvalidPluginVersion) + errDuplicatePlugin = terror.ClassPlugin.NewStd(errno.ErrDuplicatePlugin) + errInvalidPluginSysVarName = terror.ClassPlugin.NewStd(errno.ErrInvalidPluginSysVarName) + errRequireVersionCheckFail = terror.ClassPlugin.NewStd(errno.ErrRequireVersionCheckFail) ) diff --git a/privilege/privileges/errors.go b/privilege/privileges/errors.go index 7303499905d1b..a1fea3ce0c897 100644 --- a/privilege/privileges/errors.go +++ b/privilege/privileges/errors.go @@ -14,8 +14,8 @@ package privileges import ( - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" ) // error definitions. diff --git a/server/server.go b/server/server.go index fce9998baee03..c834d80e8a004 100644 --- a/server/server.go +++ b/server/server.go @@ -52,6 +52,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/metrics" "github.com/pingcap/tidb/plugin" "github.com/pingcap/tidb/sessionctx/variable" @@ -86,12 +87,12 @@ func init() { } var ( - errUnknownFieldType = terror.ClassServer.New(mysql.ErrUnknownFieldType, mysql.MySQLErrName[mysql.ErrUnknownFieldType]) - errInvalidSequence = terror.ClassServer.New(mysql.ErrInvalidSequence, mysql.MySQLErrName[mysql.ErrInvalidSequence]) - errInvalidType = terror.ClassServer.New(mysql.ErrInvalidType, mysql.MySQLErrName[mysql.ErrInvalidType]) - errNotAllowedCommand = terror.ClassServer.New(mysql.ErrNotAllowedCommand, mysql.MySQLErrName[mysql.ErrNotAllowedCommand]) - errAccessDenied = terror.ClassServer.New(mysql.ErrAccessDenied, mysql.MySQLErrName[mysql.ErrAccessDenied]) - errConCount = terror.ClassServer.New(mysql.ErrConCount, mysql.MySQLErrName[mysql.ErrConCount]) + errUnknownFieldType = terror.ClassServer.New(errno.ErrUnknownFieldType, errno.MySQLErrName[errno.ErrUnknownFieldType]) + errInvalidSequence = terror.ClassServer.New(errno.ErrInvalidSequence, errno.MySQLErrName[errno.ErrInvalidSequence]) + errInvalidType = terror.ClassServer.New(errno.ErrInvalidType, errno.MySQLErrName[errno.ErrInvalidType]) + errNotAllowedCommand = terror.ClassServer.New(errno.ErrNotAllowedCommand, errno.MySQLErrName[errno.ErrNotAllowedCommand]) + errAccessDenied = terror.ClassServer.New(errno.ErrAccessDenied, errno.MySQLErrName[errno.ErrAccessDenied]) + errConCount = terror.ClassServer.New(errno.ErrConCount, errno.MySQLErrName[errno.ErrConCount]) ) // DefaultCapability is the capability of the server when it is created using the default configuration. diff --git a/session/tidb.go b/session/tidb.go index b55f2cff94a54..c6572dc7e21ed 100644 --- a/session/tidb.go +++ b/session/tidb.go @@ -27,10 +27,10 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/parser" "github.com/pingcap/parser/ast" - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/domain" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/executor" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/sessionctx" @@ -237,7 +237,6 @@ func checkStmtLimit(ctx context.Context, sctx sessionctx.Context, se *session) e // The last history could not be "commit"/"rollback" statement. // It means it is impossible to start a new transaction at the end of the transaction. // Because after the server executed "commit"/"rollback" statement, the session is out of the transaction. - sessVars.SetStatusFlag(mysql.ServerStatusInTrans, true) } return err } @@ -375,5 +374,5 @@ func ResultSetToStringSlice(ctx context.Context, s Session, rs sqlexec.RecordSet // Session errors. var ( - ErrForUpdateCantRetry = terror.ClassSession.New(mysql.ErrForUpdateCantRetry, mysql.MySQLErrName[mysql.ErrForUpdateCantRetry]) + ErrForUpdateCantRetry = terror.ClassSession.New(errno.ErrForUpdateCantRetry, errno.MySQLErrName[errno.ErrForUpdateCantRetry]) ) diff --git a/sessionctx/variable/error.go b/sessionctx/variable/error.go new file mode 100644 index 0000000000000..016783bdb64a3 --- /dev/null +++ b/sessionctx/variable/error.go @@ -0,0 +1,37 @@ +// Copyright 2020 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package variable + +import ( + "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" +) + +// Error instances. +var ( + errCantGetValidID = terror.ClassVariable.New(mysql.ErrCantGetValidID, mysql.MySQLErrName[mysql.ErrCantGetValidID]) + errWarnDeprecatedSyntax = terror.ClassVariable.New(mysql.ErrWarnDeprecatedSyntax, mysql.MySQLErrName[mysql.ErrWarnDeprecatedSyntax]) + ErrCantSetToNull = terror.ClassVariable.New(mysql.ErrCantSetToNull, mysql.MySQLErrName[mysql.ErrCantSetToNull]) + ErrSnapshotTooOld = terror.ClassVariable.New(mysql.ErrSnapshotTooOld, mysql.MySQLErrName[mysql.ErrSnapshotTooOld]) + ErrUnsupportedValueForVar = terror.ClassVariable.New(mysql.ErrUnsupportedValueForVar, mysql.MySQLErrName[mysql.ErrUnsupportedValueForVar]) + ErrUnknownSystemVar = terror.ClassVariable.New(mysql.ErrUnknownSystemVariable, mysql.MySQLErrName[mysql.ErrUnknownSystemVariable]) + ErrIncorrectScope = terror.ClassVariable.New(mysql.ErrIncorrectGlobalLocalVar, mysql.MySQLErrName[mysql.ErrIncorrectGlobalLocalVar]) + ErrUnknownTimeZone = terror.ClassVariable.New(mysql.ErrUnknownTimeZone, mysql.MySQLErrName[mysql.ErrUnknownTimeZone]) + ErrReadOnly = terror.ClassVariable.New(mysql.ErrVariableIsReadonly, mysql.MySQLErrName[mysql.ErrVariableIsReadonly]) + ErrWrongValueForVar = terror.ClassVariable.New(mysql.ErrWrongValueForVar, mysql.MySQLErrName[mysql.ErrWrongValueForVar]) + ErrWrongTypeForVar = terror.ClassVariable.New(mysql.ErrWrongTypeForVar, mysql.MySQLErrName[mysql.ErrWrongTypeForVar]) + ErrTruncatedWrongValue = terror.ClassVariable.New(mysql.ErrTruncatedWrongValue, mysql.MySQLErrName[mysql.ErrTruncatedWrongValue]) + ErrMaxPreparedStmtCountReached = terror.ClassVariable.New(mysql.ErrMaxPreparedStmtCountReached, mysql.MySQLErrName[mysql.ErrMaxPreparedStmtCountReached]) + ErrUnsupportedIsolationLevel = terror.ClassVariable.New(mysql.ErrUnsupportedIsolationLevel, mysql.MySQLErrName[mysql.ErrUnsupportedIsolationLevel]) +) diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index 61ff0603bedca..d2521e89a0351 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -48,14 +48,6 @@ import ( var preparedStmtCount int64 -// Error instances. -var ( - errCantGetValidID = terror.ClassVariable.New(mysql.ErrCantGetValidID, mysql.MySQLErrName[mysql.ErrCantGetValidID]) - errWarnDeprecatedSyntax = terror.ClassVariable.New(mysql.ErrWarnDeprecatedSyntax, mysql.MySQLErrName[mysql.ErrWarnDeprecatedSyntax]) - ErrCantSetToNull = terror.ClassVariable.New(mysql.ErrCantSetToNull, mysql.MySQLErrName[mysql.ErrCantSetToNull]) - ErrSnapshotTooOld = terror.ClassVariable.New(mysql.ErrSnapshotTooOld, mysql.MySQLErrName[mysql.ErrSnapshotTooOld]) -) - // RetryInfo saves retry information. type RetryInfo struct { Retrying bool diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index 56f180f2a4eba..5d17a9daa5715 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -19,7 +19,6 @@ import ( "sync/atomic" "github.com/pingcap/parser/mysql" - "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/kv" ) @@ -60,20 +59,6 @@ func GetSysVar(name string) *SysVar { // PluginVarNames is global plugin var names set. var PluginVarNames []string -// Variable errors -var ( - ErrUnsupportedValueForVar = terror.ClassVariable.New(mysql.ErrUnsupportedValueForVar, mysql.MySQLErrName[mysql.ErrUnsupportedValueForVar]) - ErrUnknownSystemVar = terror.ClassVariable.New(mysql.ErrUnknownSystemVariable, mysql.MySQLErrName[mysql.ErrUnknownSystemVariable]) - ErrIncorrectScope = terror.ClassVariable.New(mysql.ErrIncorrectGlobalLocalVar, mysql.MySQLErrName[mysql.ErrIncorrectGlobalLocalVar]) - ErrUnknownTimeZone = terror.ClassVariable.New(mysql.ErrUnknownTimeZone, mysql.MySQLErrName[mysql.ErrUnknownTimeZone]) - ErrReadOnly = terror.ClassVariable.New(mysql.ErrVariableIsReadonly, mysql.MySQLErrName[mysql.ErrVariableIsReadonly]) - ErrWrongValueForVar = terror.ClassVariable.New(mysql.ErrWrongValueForVar, mysql.MySQLErrName[mysql.ErrWrongValueForVar]) - ErrWrongTypeForVar = terror.ClassVariable.New(mysql.ErrWrongTypeForVar, mysql.MySQLErrName[mysql.ErrWrongTypeForVar]) - ErrTruncatedWrongValue = terror.ClassVariable.New(mysql.ErrTruncatedWrongValue, mysql.MySQLErrName[mysql.ErrTruncatedWrongValue]) - ErrMaxPreparedStmtCountReached = terror.ClassVariable.New(mysql.ErrMaxPreparedStmtCountReached, mysql.MySQLErrName[mysql.ErrMaxPreparedStmtCountReached]) - ErrUnsupportedIsolationLevel = terror.ClassVariable.New(mysql.ErrUnsupportedIsolationLevel, mysql.MySQLErrName[mysql.ErrUnsupportedIsolationLevel]) -) - func init() { SysVars = make(map[string]*SysVar) for _, v := range defaultSysVars { diff --git a/store/tikv/error.go b/store/tikv/error.go index b4f1900f4277c..db7e092ecdcf4 100644 --- a/store/tikv/error.go +++ b/store/tikv/error.go @@ -16,8 +16,8 @@ package tikv import ( "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/kvrpcpb" - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" ) var ( diff --git a/structure/structure.go b/structure/structure.go index 0191ce0a776e6..dce4ff8dd7204 100644 --- a/structure/structure.go +++ b/structure/structure.go @@ -14,8 +14,8 @@ package structure import ( - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/kv" ) diff --git a/table/table.go b/table/table.go index d7336bf9f2793..3a54b2a481a6f 100644 --- a/table/table.go +++ b/table/table.go @@ -22,8 +22,8 @@ import ( "github.com/opentracing/opentracing-go" "github.com/pingcap/parser/model" - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" "github.com/pingcap/tidb/sessionctx" diff --git a/tablecodec/tablecodec.go b/tablecodec/tablecodec.go index 0899df94ec919..8871a21dbf1a3 100644 --- a/tablecodec/tablecodec.go +++ b/tablecodec/tablecodec.go @@ -22,6 +22,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/structure" @@ -31,9 +32,9 @@ import ( ) var ( - errInvalidKey = terror.ClassXEval.New(mysql.ErrInvalidKey, mysql.MySQLErrName[mysql.ErrInvalidKey]) - errInvalidRecordKey = terror.ClassXEval.New(mysql.ErrInvalidRecordKey, mysql.MySQLErrName[mysql.ErrInvalidRecordKey]) - errInvalidIndexKey = terror.ClassXEval.New(mysql.ErrInvalidIndexKey, mysql.MySQLErrName[mysql.ErrInvalidIndexKey]) + errInvalidKey = terror.ClassXEval.New(errno.ErrInvalidKey, errno.MySQLErrName[errno.ErrInvalidKey]) + errInvalidRecordKey = terror.ClassXEval.New(errno.ErrInvalidRecordKey, errno.MySQLErrName[errno.ErrInvalidRecordKey]) + errInvalidIndexKey = terror.ClassXEval.New(errno.ErrInvalidIndexKey, errno.MySQLErrName[errno.ErrInvalidIndexKey]) ) var ( diff --git a/types/errors.go b/types/errors.go index 92859f995bca7..20af1424e941e 100644 --- a/types/errors.go +++ b/types/errors.go @@ -14,9 +14,9 @@ package types import ( - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" parser_types "github.com/pingcap/parser/types" + mysql "github.com/pingcap/tidb/errno" ) // const strings for ErrWrongValue diff --git a/types/json/constants.go b/types/json/constants.go index 3e276c918b5b4..c6f17c992ad67 100644 --- a/types/json/constants.go +++ b/types/json/constants.go @@ -17,8 +17,8 @@ import ( "encoding/binary" "unicode/utf8" - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + mysql "github.com/pingcap/tidb/errno" ) // TypeCode indicates JSON type. diff --git a/util/admin/admin.go b/util/admin/admin.go index 12c02fd5e31aa..2bb1e7dd44261 100644 --- a/util/admin/admin.go +++ b/util/admin/admin.go @@ -24,6 +24,7 @@ import ( "github.com/pingcap/parser/model" "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" @@ -428,11 +429,11 @@ func iterRecords(sessCtx sessionctx.Context, retriever kv.Retriever, t table.Tab var ( // ErrDataInConsistent indicate that meets inconsistent data. - ErrDataInConsistent = terror.ClassAdmin.New(mysql.ErrDataInConsistent, mysql.MySQLErrName[mysql.ErrDataInConsistent]) + ErrDataInConsistent = terror.ClassAdmin.New(errno.ErrDataInConsistent, errno.MySQLErrName[errno.ErrDataInConsistent]) // ErrDDLJobNotFound indicates the job id was not found. - ErrDDLJobNotFound = terror.ClassAdmin.New(mysql.ErrDDLJobNotFound, mysql.MySQLErrName[mysql.ErrDDLJobNotFound]) + ErrDDLJobNotFound = terror.ClassAdmin.New(errno.ErrDDLJobNotFound, errno.MySQLErrName[errno.ErrDDLJobNotFound]) // ErrCancelFinishedDDLJob returns when cancel a finished ddl job. - ErrCancelFinishedDDLJob = terror.ClassAdmin.New(mysql.ErrCancelFinishedDDLJob, mysql.MySQLErrName[mysql.ErrCancelFinishedDDLJob]) + ErrCancelFinishedDDLJob = terror.ClassAdmin.New(errno.ErrCancelFinishedDDLJob, errno.MySQLErrName[errno.ErrCancelFinishedDDLJob]) // ErrCannotCancelDDLJob returns when cancel a almost finished ddl job, because cancel in now may cause data inconsistency. - ErrCannotCancelDDLJob = terror.ClassAdmin.New(mysql.ErrCannotCancelDDLJob, mysql.MySQLErrName[mysql.ErrCannotCancelDDLJob]) + ErrCannotCancelDDLJob = terror.ClassAdmin.New(errno.ErrCannotCancelDDLJob, errno.MySQLErrName[errno.ErrCannotCancelDDLJob]) ) diff --git a/util/memory/action.go b/util/memory/action.go index 5fe62f0ea97ec..b1081ba5c1adc 100644 --- a/util/memory/action.go +++ b/util/memory/action.go @@ -17,8 +17,8 @@ import ( "fmt" "sync" - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/util/logutil" "go.uber.org/zap" ) @@ -100,7 +100,7 @@ func (a *PanicOnExceed) Action(t *Tracker) { func (a *PanicOnExceed) SetFallback(ActionOnExceed) {} var ( - errMemExceedThreshold = terror.ClassUtil.New(mysql.ErrMemExceedThreshold, mysql.MySQLErrName[mysql.ErrMemExceedThreshold]) + errMemExceedThreshold = terror.ClassUtil.New(errno.ErrMemExceedThreshold, errno.MySQLErrName[errno.ErrMemExceedThreshold]) ) const ( diff --git a/util/ranger/points.go b/util/ranger/points.go index f1b283ad8d5c8..53c9abb5da65e 100644 --- a/util/ranger/points.go +++ b/util/ranger/points.go @@ -22,6 +22,7 @@ import ( "github.com/pingcap/parser/ast" "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" @@ -32,7 +33,7 @@ import ( // Error instances. var ( - ErrUnsupportedType = terror.ClassOptimizer.New(mysql.ErrUnsupportedType, mysql.MySQLErrName[mysql.ErrUnsupportedType]) + ErrUnsupportedType = terror.ClassOptimizer.New(errno.ErrUnsupportedType, errno.MySQLErrName[errno.ErrUnsupportedType]) ) // RangeType is alias for int. From 3ceaf48004a2a6e5e50eec91acecf1a0e4cfdd45 Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Wed, 11 Mar 2020 12:05:12 +0800 Subject: [PATCH 2/6] fix test build --- ddl/db_integration_test.go | 317 +++++++++++++------------- ddl/db_test.go | 267 +++++++++++----------- ddl/sequence_test.go | 2 +- domain/domain_test.go | 6 +- executor/seqtest/seq_executor_test.go | 3 +- server/server_test.go | 37 +-- table/table_test.go | 2 +- util/memory/tracker_test.go | 4 +- 8 files changed, 321 insertions(+), 317 deletions(-) diff --git a/ddl/db_integration_test.go b/ddl/db_integration_test.go index 82309bc6ff114..1faea03e9c4a9 100644 --- a/ddl/db_integration_test.go +++ b/ddl/db_integration_test.go @@ -30,6 +30,7 @@ import ( "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/domain" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" @@ -131,11 +132,11 @@ func (s *testIntegrationSuite5) TestNoZeroDateMode(c *C) { tk.MustExec("use test;") tk.MustExec("set session sql_mode='STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION';") - tk.MustGetErrCode("create table test_zero_date(agent_start_time date NOT NULL DEFAULT '0000-00-00')", mysql.ErrInvalidDefault) - tk.MustGetErrCode("create table test_zero_date(agent_start_time datetime NOT NULL DEFAULT '0000-00-00 00:00:00')", mysql.ErrInvalidDefault) - tk.MustGetErrCode("create table test_zero_date(agent_start_time timestamp NOT NULL DEFAULT '0000-00-00 00:00:00')", mysql.ErrInvalidDefault) - tk.MustGetErrCode("create table test_zero_date(a timestamp default '0000-00-00 00');", mysql.ErrInvalidDefault) - tk.MustGetErrCode("create table test_zero_date(a timestamp default 0);", mysql.ErrInvalidDefault) + tk.MustGetErrCode("create table test_zero_date(agent_start_time date NOT NULL DEFAULT '0000-00-00')", errno.ErrInvalidDefault) + tk.MustGetErrCode("create table test_zero_date(agent_start_time datetime NOT NULL DEFAULT '0000-00-00 00:00:00')", errno.ErrInvalidDefault) + tk.MustGetErrCode("create table test_zero_date(agent_start_time timestamp NOT NULL DEFAULT '0000-00-00 00:00:00')", errno.ErrInvalidDefault) + tk.MustGetErrCode("create table test_zero_date(a timestamp default '0000-00-00 00');", errno.ErrInvalidDefault) + tk.MustGetErrCode("create table test_zero_date(a timestamp default 0);", errno.ErrInvalidDefault) } func (s *testIntegrationSuite2) TestInvalidDefault(c *C) { @@ -257,7 +258,7 @@ func (s *testIntegrationSuite3) TestIssue2293(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("create table t_issue_2293 (a int)") - tk.MustGetErrCode("alter table t_issue_2293 add b int not null default 'a'", mysql.ErrInvalidDefault) + tk.MustGetErrCode("alter table t_issue_2293 add b int not null default 'a'", errno.ErrInvalidDefault) tk.MustExec("insert into t_issue_2293 value(1)") tk.MustQuery("select * from t_issue_2293").Check(testkit.Rows("1")) } @@ -268,7 +269,7 @@ func (s *testIntegrationSuite2) TestIssue6101(c *C) { tk.MustExec("create table t1 (quantity decimal(2) unsigned);") _, err := tk.Exec("insert into t1 values (500), (-500), (~0), (-1);") terr := errors.Cause(err).(*terror.Error) - c.Assert(terr.Code(), Equals, terror.ErrCode(mysql.ErrWarnDataOutOfRange)) + c.Assert(terr.Code(), Equals, terror.ErrCode(errno.ErrWarnDataOutOfRange)) tk.MustExec("drop table t1") tk.MustExec("set sql_mode=''") @@ -301,15 +302,15 @@ func (s *testIntegrationSuite3) TestIssue3833(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("create table issue3833 (b char(0), c binary(0), d varchar(0))") - tk.MustGetErrCode("create index idx on issue3833 (b)", mysql.ErrWrongKeyColumn) - tk.MustGetErrCode("alter table issue3833 add index idx (b)", mysql.ErrWrongKeyColumn) - tk.MustGetErrCode("create table issue3833_2 (b char(0), c binary(0), d varchar(0), index(b))", mysql.ErrWrongKeyColumn) - tk.MustGetErrCode("create index idx on issue3833 (c)", mysql.ErrWrongKeyColumn) - tk.MustGetErrCode("alter table issue3833 add index idx (c)", mysql.ErrWrongKeyColumn) - tk.MustGetErrCode("create table issue3833_2 (b char(0), c binary(0), d varchar(0), index(c))", mysql.ErrWrongKeyColumn) - tk.MustGetErrCode("create index idx on issue3833 (d)", mysql.ErrWrongKeyColumn) - tk.MustGetErrCode("alter table issue3833 add index idx (d)", mysql.ErrWrongKeyColumn) - tk.MustGetErrCode("create table issue3833_2 (b char(0), c binary(0), d varchar(0), index(d))", mysql.ErrWrongKeyColumn) + tk.MustGetErrCode("create index idx on issue3833 (b)", errno.ErrWrongKeyColumn) + tk.MustGetErrCode("alter table issue3833 add index idx (b)", errno.ErrWrongKeyColumn) + tk.MustGetErrCode("create table issue3833_2 (b char(0), c binary(0), d varchar(0), index(b))", errno.ErrWrongKeyColumn) + tk.MustGetErrCode("create index idx on issue3833 (c)", errno.ErrWrongKeyColumn) + tk.MustGetErrCode("alter table issue3833 add index idx (c)", errno.ErrWrongKeyColumn) + tk.MustGetErrCode("create table issue3833_2 (b char(0), c binary(0), d varchar(0), index(c))", errno.ErrWrongKeyColumn) + tk.MustGetErrCode("create index idx on issue3833 (d)", errno.ErrWrongKeyColumn) + tk.MustGetErrCode("alter table issue3833 add index idx (d)", errno.ErrWrongKeyColumn) + tk.MustGetErrCode("create table issue3833_2 (b char(0), c binary(0), d varchar(0), index(d))", errno.ErrWrongKeyColumn) } func (s *testIntegrationSuite1) TestIssue2858And2717(c *C) { @@ -354,151 +355,151 @@ func (s *testIntegrationSuite1) TestIssue4432(c *C) { tk.MustExec("drop table tx") } -func (s *testIntegrationSuite5) TestMySQLErrorCode(c *C) { +func (s *testIntegrationSuite5) TestErrnoErrorCode(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test_db") // create database sql := "create database aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - tk.MustGetErrCode(sql, mysql.ErrTooLongIdent) + tk.MustGetErrCode(sql, errno.ErrTooLongIdent) sql = "create database test" - tk.MustGetErrCode(sql, mysql.ErrDBCreateExists) + tk.MustGetErrCode(sql, errno.ErrDBCreateExists) sql = "create database test1 character set uft8;" - tk.MustGetErrCode(sql, mysql.ErrUnknownCharacterSet) + tk.MustGetErrCode(sql, errno.ErrUnknownCharacterSet) sql = "create database test2 character set gkb;" - tk.MustGetErrCode(sql, mysql.ErrUnknownCharacterSet) + tk.MustGetErrCode(sql, errno.ErrUnknownCharacterSet) sql = "create database test3 character set laitn1;" - tk.MustGetErrCode(sql, mysql.ErrUnknownCharacterSet) + tk.MustGetErrCode(sql, errno.ErrUnknownCharacterSet) // drop database sql = "drop database db_not_exist" - tk.MustGetErrCode(sql, mysql.ErrDBDropExists) + tk.MustGetErrCode(sql, errno.ErrDBDropExists) // create table tk.MustExec("create table test_error_code_succ (c1 int, c2 int, c3 int, primary key(c3))") sql = "create table test_error_code_succ (c1 int, c2 int, c3 int)" - tk.MustGetErrCode(sql, mysql.ErrTableExists) + tk.MustGetErrCode(sql, errno.ErrTableExists) sql = "create table test_error_code1 (c1 int, c2 int, c2 int)" - tk.MustGetErrCode(sql, mysql.ErrDupFieldName) + tk.MustGetErrCode(sql, errno.ErrDupFieldName) sql = "create table test_error_code1 (c1 int, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int)" - tk.MustGetErrCode(sql, mysql.ErrTooLongIdent) + tk.MustGetErrCode(sql, errno.ErrTooLongIdent) sql = "create table aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(a int)" - tk.MustGetErrCode(sql, mysql.ErrTooLongIdent) + tk.MustGetErrCode(sql, errno.ErrTooLongIdent) sql = "create table test_error_code1 (c1 int, c2 int, key aa (c1, c2), key aa (c1))" - tk.MustGetErrCode(sql, mysql.ErrDupKeyName) + tk.MustGetErrCode(sql, errno.ErrDupKeyName) sql = "create table test_error_code1 (c1 int, c2 int, c3 int, key(c_not_exist))" - tk.MustGetErrCode(sql, mysql.ErrKeyColumnDoesNotExits) + tk.MustGetErrCode(sql, errno.ErrKeyColumnDoesNotExits) sql = "create table test_error_code1 (c1 int, c2 int, c3 int, primary key(c_not_exist))" - tk.MustGetErrCode(sql, mysql.ErrKeyColumnDoesNotExits) + tk.MustGetErrCode(sql, errno.ErrKeyColumnDoesNotExits) sql = "create table test_error_code1 (c1 int not null default '')" - tk.MustGetErrCode(sql, mysql.ErrInvalidDefault) + tk.MustGetErrCode(sql, errno.ErrInvalidDefault) sql = "CREATE TABLE `t` (`a` double DEFAULT 1.0 DEFAULT 2.0 DEFAULT now());" - tk.MustGetErrCode(sql, mysql.ErrInvalidDefault) + tk.MustGetErrCode(sql, errno.ErrInvalidDefault) sql = "CREATE TABLE `t` (`a` double DEFAULT now());" - tk.MustGetErrCode(sql, mysql.ErrInvalidDefault) + tk.MustGetErrCode(sql, errno.ErrInvalidDefault) sql = "create table t1(a int) character set uft8;" - tk.MustGetErrCode(sql, mysql.ErrUnknownCharacterSet) + tk.MustGetErrCode(sql, errno.ErrUnknownCharacterSet) sql = "create table t1(a int) character set gkb;" - tk.MustGetErrCode(sql, mysql.ErrUnknownCharacterSet) + tk.MustGetErrCode(sql, errno.ErrUnknownCharacterSet) sql = "create table t1(a int) character set laitn1;" - tk.MustGetErrCode(sql, mysql.ErrUnknownCharacterSet) + tk.MustGetErrCode(sql, errno.ErrUnknownCharacterSet) sql = "create table test_error_code (a int not null ,b int not null,c int not null, d int not null, foreign key (b, c) references product(id));" - tk.MustGetErrCode(sql, mysql.ErrWrongFkDef) + tk.MustGetErrCode(sql, errno.ErrWrongFkDef) sql = "create table test_error_code_2;" - tk.MustGetErrCode(sql, mysql.ErrTableMustHaveColumns) + tk.MustGetErrCode(sql, errno.ErrTableMustHaveColumns) sql = "create table test_error_code_2 (unique(c1));" - tk.MustGetErrCode(sql, mysql.ErrTableMustHaveColumns) + tk.MustGetErrCode(sql, errno.ErrTableMustHaveColumns) sql = "create table test_error_code_2(c1 int, c2 int, c3 int, primary key(c1), primary key(c2));" - tk.MustGetErrCode(sql, mysql.ErrMultiplePriKey) + tk.MustGetErrCode(sql, errno.ErrMultiplePriKey) sql = "create table test_error_code_3(pt blob ,primary key (pt));" - tk.MustGetErrCode(sql, mysql.ErrBlobKeyWithoutLength) + tk.MustGetErrCode(sql, errno.ErrBlobKeyWithoutLength) sql = "create table test_error_code_3(a text, unique (a(3073)));" - tk.MustGetErrCode(sql, mysql.ErrTooLongKey) + tk.MustGetErrCode(sql, errno.ErrTooLongKey) sql = "create table test_error_code_3(`id` int, key `primary`(`id`));" - tk.MustGetErrCode(sql, mysql.ErrWrongNameForIndex) + tk.MustGetErrCode(sql, errno.ErrWrongNameForIndex) sql = "create table t2(c1.c2 blob default null);" - tk.MustGetErrCode(sql, mysql.ErrWrongTableName) + tk.MustGetErrCode(sql, errno.ErrWrongTableName) sql = "create table t2 (id int default null primary key , age int);" - tk.MustGetErrCode(sql, mysql.ErrInvalidDefault) + tk.MustGetErrCode(sql, errno.ErrInvalidDefault) sql = "create table t2 (id int null primary key , age int);" - tk.MustGetErrCode(sql, mysql.ErrPrimaryCantHaveNull) + tk.MustGetErrCode(sql, errno.ErrPrimaryCantHaveNull) sql = "create table t2 (id int default null, age int, primary key(id));" - tk.MustGetErrCode(sql, mysql.ErrPrimaryCantHaveNull) + tk.MustGetErrCode(sql, errno.ErrPrimaryCantHaveNull) sql = "create table t2 (id int null, age int, primary key(id));" - tk.MustGetErrCode(sql, mysql.ErrPrimaryCantHaveNull) + tk.MustGetErrCode(sql, errno.ErrPrimaryCantHaveNull) sql = "create table t2 (id int auto_increment);" - tk.MustGetErrCode(sql, mysql.ErrWrongAutoKey) + tk.MustGetErrCode(sql, errno.ErrWrongAutoKey) sql = "create table t2 (id int auto_increment, a int key);" - tk.MustGetErrCode(sql, mysql.ErrWrongAutoKey) + tk.MustGetErrCode(sql, errno.ErrWrongAutoKey) sql = "create table t2 (a datetime(2) default current_timestamp(3));" - tk.MustGetErrCode(sql, mysql.ErrInvalidDefault) + tk.MustGetErrCode(sql, errno.ErrInvalidDefault) sql = "create table t2 (a datetime(2) default current_timestamp(2) on update current_timestamp);" - tk.MustGetErrCode(sql, mysql.ErrInvalidOnUpdate) + tk.MustGetErrCode(sql, errno.ErrInvalidOnUpdate) sql = "create table t2 (a datetime default current_timestamp on update current_timestamp(2));" - tk.MustGetErrCode(sql, mysql.ErrInvalidOnUpdate) + tk.MustGetErrCode(sql, errno.ErrInvalidOnUpdate) sql = "create table t2 (a datetime(2) default current_timestamp(2) on update current_timestamp(3));" - tk.MustGetErrCode(sql, mysql.ErrInvalidOnUpdate) + tk.MustGetErrCode(sql, errno.ErrInvalidOnUpdate) sql = "create table t(a blob(10), index(a(0)));" - tk.MustGetErrCode(sql, mysql.ErrKeyPart0) + tk.MustGetErrCode(sql, errno.ErrKeyPart0) sql = "create table t(a char(10), index(a(0)));" - tk.MustGetErrCode(sql, mysql.ErrKeyPart0) + tk.MustGetErrCode(sql, errno.ErrKeyPart0) sql = "create table t2 (id int primary key , age int);" tk.MustExec(sql) // add column sql = "alter table test_error_code_succ add column c1 int" - tk.MustGetErrCode(sql, mysql.ErrDupFieldName) + tk.MustGetErrCode(sql, errno.ErrDupFieldName) sql = "alter table test_error_code_succ add column aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int" - tk.MustGetErrCode(sql, mysql.ErrTooLongIdent) + tk.MustGetErrCode(sql, errno.ErrTooLongIdent) sql = "alter table test_comment comment 'test comment'" - tk.MustGetErrCode(sql, mysql.ErrNoSuchTable) + tk.MustGetErrCode(sql, errno.ErrNoSuchTable) sql = "alter table test_error_code_succ add column `a ` int ;" - tk.MustGetErrCode(sql, mysql.ErrWrongColumnName) + tk.MustGetErrCode(sql, errno.ErrWrongColumnName) tk.MustExec("create table test_on_update (c1 int, c2 int);") sql = "alter table test_on_update add column c3 int on update current_timestamp;" - tk.MustGetErrCode(sql, mysql.ErrInvalidOnUpdate) + tk.MustGetErrCode(sql, errno.ErrInvalidOnUpdate) sql = "create table test_on_update_2(c int on update current_timestamp);" - tk.MustGetErrCode(sql, mysql.ErrInvalidOnUpdate) + tk.MustGetErrCode(sql, errno.ErrInvalidOnUpdate) // drop column sql = "alter table test_error_code_succ drop c_not_exist" - tk.MustGetErrCode(sql, mysql.ErrCantDropFieldOrKey) + tk.MustGetErrCode(sql, errno.ErrCantDropFieldOrKey) tk.MustExec("create table test_drop_column (c1 int );") sql = "alter table test_drop_column drop column c1;" - tk.MustGetErrCode(sql, mysql.ErrCantRemoveAllFields) + tk.MustGetErrCode(sql, errno.ErrCantRemoveAllFields) // add index sql = "alter table test_error_code_succ add index idx (c_not_exist)" - tk.MustGetErrCode(sql, mysql.ErrKeyColumnDoesNotExits) + tk.MustGetErrCode(sql, errno.ErrKeyColumnDoesNotExits) tk.MustExec("alter table test_error_code_succ add index idx (c1)") sql = "alter table test_error_code_succ add index idx (c1)" - tk.MustGetErrCode(sql, mysql.ErrDupKeyName) + tk.MustGetErrCode(sql, errno.ErrDupKeyName) // drop index sql = "alter table test_error_code_succ drop index idx_not_exist" - tk.MustGetErrCode(sql, mysql.ErrCantDropFieldOrKey) + tk.MustGetErrCode(sql, errno.ErrCantDropFieldOrKey) sql = "alter table test_error_code_succ drop column c3" - tk.MustGetErrCode(sql, int(mysql.ErrUnsupportedDDLOperation)) + tk.MustGetErrCode(sql, int(errno.ErrUnsupportedDDLOperation)) // modify column sql = "alter table test_error_code_succ modify testx.test_error_code_succ.c1 bigint" - tk.MustGetErrCode(sql, mysql.ErrWrongDBName) + tk.MustGetErrCode(sql, errno.ErrWrongDBName) sql = "alter table test_error_code_succ modify t.c1 bigint" - tk.MustGetErrCode(sql, mysql.ErrWrongTableName) + tk.MustGetErrCode(sql, errno.ErrWrongTableName) // insert value tk.MustExec("create table test_error_code_null(c1 char(100) not null);") sql = "insert into test_error_code_null (c1) values(null);" - tk.MustGetErrCode(sql, mysql.ErrBadNull) + tk.MustGetErrCode(sql, errno.ErrBadNull) } func (s *testIntegrationSuite3) TestTableDDLWithFloatType(c *C) { s.tk = testkit.NewTestKit(c, s.store) s.tk.MustExec("use test") s.tk.MustExec("drop table if exists t") - s.tk.MustGetErrCode("create table t (a decimal(1, 2))", mysql.ErrMBiggerThanD) - s.tk.MustGetErrCode("create table t (a float(1, 2))", mysql.ErrMBiggerThanD) - s.tk.MustGetErrCode("create table t (a double(1, 2))", mysql.ErrMBiggerThanD) + s.tk.MustGetErrCode("create table t (a decimal(1, 2))", errno.ErrMBiggerThanD) + s.tk.MustGetErrCode("create table t (a float(1, 2))", errno.ErrMBiggerThanD) + s.tk.MustGetErrCode("create table t (a double(1, 2))", errno.ErrMBiggerThanD) s.tk.MustExec("create table t (a double(1, 1))") - s.tk.MustGetErrCode("alter table t add column b decimal(1, 2)", mysql.ErrMBiggerThanD) + s.tk.MustGetErrCode("alter table t add column b decimal(1, 2)", errno.ErrMBiggerThanD) // add multi columns now not support, so no case. - s.tk.MustGetErrCode("alter table t modify column a float(1, 4)", mysql.ErrMBiggerThanD) - s.tk.MustGetErrCode("alter table t change column a aa float(1, 4)", mysql.ErrMBiggerThanD) + s.tk.MustGetErrCode("alter table t modify column a float(1, 4)", errno.ErrMBiggerThanD) + s.tk.MustGetErrCode("alter table t change column a aa float(1, 4)", errno.ErrMBiggerThanD) s.tk.MustExec("drop table t") } @@ -506,21 +507,21 @@ func (s *testIntegrationSuite1) TestTableDDLWithTimeType(c *C) { s.tk = testkit.NewTestKit(c, s.store) s.tk.MustExec("use test") s.tk.MustExec("drop table if exists t") - s.tk.MustGetErrCode("create table t (a time(7))", mysql.ErrTooBigPrecision) - s.tk.MustGetErrCode("create table t (a datetime(7))", mysql.ErrTooBigPrecision) - s.tk.MustGetErrCode("create table t (a timestamp(7))", mysql.ErrTooBigPrecision) + s.tk.MustGetErrCode("create table t (a time(7))", errno.ErrTooBigPrecision) + s.tk.MustGetErrCode("create table t (a datetime(7))", errno.ErrTooBigPrecision) + s.tk.MustGetErrCode("create table t (a timestamp(7))", errno.ErrTooBigPrecision) _, err := s.tk.Exec("create table t (a time(-1))") c.Assert(err, NotNil) s.tk.MustExec("create table t (a datetime)") - s.tk.MustGetErrCode("alter table t add column b time(7)", mysql.ErrTooBigPrecision) - s.tk.MustGetErrCode("alter table t add column b datetime(7)", mysql.ErrTooBigPrecision) - s.tk.MustGetErrCode("alter table t add column b timestamp(7)", mysql.ErrTooBigPrecision) - s.tk.MustGetErrCode("alter table t modify column a time(7)", mysql.ErrTooBigPrecision) - s.tk.MustGetErrCode("alter table t modify column a datetime(7)", mysql.ErrTooBigPrecision) - s.tk.MustGetErrCode("alter table t modify column a timestamp(7)", mysql.ErrTooBigPrecision) - s.tk.MustGetErrCode("alter table t change column a aa time(7)", mysql.ErrTooBigPrecision) - s.tk.MustGetErrCode("alter table t change column a aa datetime(7)", mysql.ErrTooBigPrecision) - s.tk.MustGetErrCode("alter table t change column a aa timestamp(7)", mysql.ErrTooBigPrecision) + s.tk.MustGetErrCode("alter table t add column b time(7)", errno.ErrTooBigPrecision) + s.tk.MustGetErrCode("alter table t add column b datetime(7)", errno.ErrTooBigPrecision) + s.tk.MustGetErrCode("alter table t add column b timestamp(7)", errno.ErrTooBigPrecision) + s.tk.MustGetErrCode("alter table t modify column a time(7)", errno.ErrTooBigPrecision) + s.tk.MustGetErrCode("alter table t modify column a datetime(7)", errno.ErrTooBigPrecision) + s.tk.MustGetErrCode("alter table t modify column a timestamp(7)", errno.ErrTooBigPrecision) + s.tk.MustGetErrCode("alter table t change column a aa time(7)", errno.ErrTooBigPrecision) + s.tk.MustGetErrCode("alter table t change column a aa datetime(7)", errno.ErrTooBigPrecision) + s.tk.MustGetErrCode("alter table t change column a aa timestamp(7)", errno.ErrTooBigPrecision) s.tk.MustExec("alter table t change column a aa datetime(0)") s.tk.MustExec("drop table t") } @@ -613,11 +614,11 @@ func (s *testIntegrationSuite2) TestDependedGeneratedColumnPrior2GeneratedColumn ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin") // should check unknown column first, then the prior ones. sql := "alter table t add column d int as (c + f + 1) first" - tk.MustGetErrCode(sql, mysql.ErrBadField) + tk.MustGetErrCode(sql, errno.ErrBadField) // depended generated column should be prior to generated column self sql = "alter table t add column d int as (c+1) first" - tk.MustGetErrCode(sql, mysql.ErrGeneratedColumnNonPrior) + tk.MustGetErrCode(sql, errno.ErrGeneratedColumnNonPrior) // correct case tk.MustExec("alter table t add column d int as (c+1) after c") @@ -642,14 +643,14 @@ func (s *testIntegrationSuite3) TestChangingCharsetToUtf8(c *C) { tk.MustExec("alter table t modify column a varchar(20) charset latin1") tk.MustQuery("select * from t;").Check(testkit.Rows("t_value")) - tk.MustGetErrCode("alter table t modify column a varchar(20) charset utf8", mysql.ErrUnsupportedDDLOperation) - tk.MustGetErrCode("alter table t modify column a varchar(20) charset utf8mb4", mysql.ErrUnsupportedDDLOperation) - tk.MustGetErrCode("alter table t modify column a varchar(20) charset utf8 collate utf8_bin", mysql.ErrUnsupportedDDLOperation) - tk.MustGetErrCode("alter table t modify column a varchar(20) charset utf8mb4 collate utf8mb4_general_ci", mysql.ErrUnsupportedDDLOperation) + tk.MustGetErrCode("alter table t modify column a varchar(20) charset utf8", errno.ErrUnsupportedDDLOperation) + tk.MustGetErrCode("alter table t modify column a varchar(20) charset utf8mb4", errno.ErrUnsupportedDDLOperation) + tk.MustGetErrCode("alter table t modify column a varchar(20) charset utf8 collate utf8_bin", errno.ErrUnsupportedDDLOperation) + tk.MustGetErrCode("alter table t modify column a varchar(20) charset utf8mb4 collate utf8mb4_general_ci", errno.ErrUnsupportedDDLOperation) - tk.MustGetErrCode("alter table t modify column a varchar(20) charset utf8mb4 collate utf8bin", mysql.ErrUnknownCollation) - tk.MustGetErrCode("alter table t collate LATIN1_GENERAL_CI charset utf8 collate utf8_bin", mysql.ErrConflictingDeclarations) - tk.MustGetErrCode("alter table t collate LATIN1_GENERAL_CI collate UTF8MB4_UNICODE_ci collate utf8_bin", mysql.ErrCollationCharsetMismatch) + tk.MustGetErrCode("alter table t modify column a varchar(20) charset utf8mb4 collate utf8bin", errno.ErrUnknownCollation) + tk.MustGetErrCode("alter table t collate LATIN1_GENERAL_CI charset utf8 collate utf8_bin", errno.ErrConflictingDeclarations) + tk.MustGetErrCode("alter table t collate LATIN1_GENERAL_CI collate UTF8MB4_UNICODE_ci collate utf8_bin", errno.ErrCollationCharsetMismatch) } func (s *testIntegrationSuite4) TestChangingTableCharset(c *C) { @@ -658,20 +659,20 @@ func (s *testIntegrationSuite4) TestChangingTableCharset(c *C) { tk.MustExec("USE test") tk.MustExec("create table t(a char(10)) charset latin1 collate latin1_bin") - tk.MustGetErrCode("alter table t charset gbk", mysql.ErrUnknownCharacterSet) - tk.MustGetErrCode("alter table t charset ''", mysql.ErrUnknownCharacterSet) + tk.MustGetErrCode("alter table t charset gbk", errno.ErrUnknownCharacterSet) + tk.MustGetErrCode("alter table t charset ''", errno.ErrUnknownCharacterSet) - tk.MustGetErrCode("alter table t charset utf8mb4 collate '' collate utf8mb4_bin;", mysql.ErrUnknownCollation) + tk.MustGetErrCode("alter table t charset utf8mb4 collate '' collate utf8mb4_bin;", errno.ErrUnknownCollation) - tk.MustGetErrCode("alter table t charset utf8 collate latin1_bin", mysql.ErrCollationCharsetMismatch) - tk.MustGetErrCode("alter table t charset utf8 collate utf8mb4_bin;", mysql.ErrCollationCharsetMismatch) - tk.MustGetErrCode("alter table t charset utf8 collate utf8_bin collate utf8mb4_bin collate utf8_bin;", mysql.ErrCollationCharsetMismatch) + tk.MustGetErrCode("alter table t charset utf8 collate latin1_bin", errno.ErrCollationCharsetMismatch) + tk.MustGetErrCode("alter table t charset utf8 collate utf8mb4_bin;", errno.ErrCollationCharsetMismatch) + tk.MustGetErrCode("alter table t charset utf8 collate utf8_bin collate utf8mb4_bin collate utf8_bin;", errno.ErrCollationCharsetMismatch) - tk.MustGetErrCode("alter table t charset utf8", mysql.ErrUnsupportedDDLOperation) - tk.MustGetErrCode("alter table t charset utf8mb4", mysql.ErrUnsupportedDDLOperation) - tk.MustGetErrCode("alter table t charset utf8mb4 collate utf8mb4_bin", mysql.ErrUnsupportedDDLOperation) + tk.MustGetErrCode("alter table t charset utf8", errno.ErrUnsupportedDDLOperation) + tk.MustGetErrCode("alter table t charset utf8mb4", errno.ErrUnsupportedDDLOperation) + tk.MustGetErrCode("alter table t charset utf8mb4 collate utf8mb4_bin", errno.ErrUnsupportedDDLOperation) - tk.MustGetErrCode("alter table t charset latin1 charset utf8 charset utf8mb4 collate utf8_bin;", mysql.ErrConflictingDeclarations) + tk.MustGetErrCode("alter table t charset latin1 charset utf8 charset utf8mb4 collate utf8_bin;", errno.ErrConflictingDeclarations) // Test change column charset when changing table charset. tk.MustExec("drop table t;") @@ -692,7 +693,7 @@ func (s *testIntegrationSuite4) TestChangingTableCharset(c *C) { // Test when column charset can not convert to the target charset. tk.MustExec("drop table t;") tk.MustExec("create table t(a varchar(10) character set ascii) charset utf8mb4") - tk.MustGetErrCode("alter table t convert to charset utf8mb4;", mysql.ErrUnsupportedDDLOperation) + tk.MustGetErrCode("alter table t convert to charset utf8mb4;", errno.ErrUnsupportedDDLOperation) tk.MustExec("drop table t;") tk.MustExec("create table t(a varchar(10) character set utf8) charset utf8") @@ -1173,7 +1174,7 @@ func (s *testIntegrationSuite6) TestCreateTableTooLarge(c *C) { } } sql += ");" - s.tk.MustGetErrCode(sql, mysql.ErrTooManyFields) + s.tk.MustGetErrCode(sql, errno.ErrTooManyFields) originLimit := atomic.LoadUint32(&ddl.TableColumnCountLimit) atomic.StoreUint32(&ddl.TableColumnCountLimit, uint32(cnt*4)) @@ -1203,7 +1204,7 @@ func (s *testIntegrationSuite3) TestChangeColumnPosition(c *C) { s.tk.MustQuery("select * from position1").Check(testkit.Rows("TiDB 2 3.14 1")) s.tk.MustExec("alter table position1 modify column c double first") s.tk.MustQuery("select * from position1").Check(testkit.Rows("3.14 TiDB 2 1")) - s.tk.MustGetErrCode("alter table position1 modify column b int after b", mysql.ErrBadField) + s.tk.MustGetErrCode("alter table position1 modify column b int after b", errno.ErrBadField) s.tk.MustExec("create table position2 (a int, b int)") s.tk.MustExec("alter table position2 add index t(a, b)") @@ -1212,7 +1213,7 @@ func (s *testIntegrationSuite3) TestChangeColumnPosition(c *C) { s.tk.MustQuery("select a from position2 where a = 3").Check(testkit.Rows()) s.tk.MustExec("alter table position2 change column b c int first") s.tk.MustQuery("select * from position2 where c = 3").Check(testkit.Rows("3 5")) - s.tk.MustGetErrCode("alter table position2 change column c b int after c", mysql.ErrBadField) + s.tk.MustGetErrCode("alter table position2 change column c b int after c", errno.ErrBadField) s.tk.MustExec("create table position3 (a int default 2)") s.tk.MustExec("alter table position3 modify column a int default 5 first") @@ -1241,9 +1242,9 @@ func (s *testIntegrationSuite2) TestAddIndexAfterAddColumn(c *C) { s.tk.MustExec("insert into test_add_index_after_add_col values(1, 2),(2,2)") s.tk.MustExec("alter table test_add_index_after_add_col add column c int not null default '0'") sql := "alter table test_add_index_after_add_col add unique index cc(c) " - s.tk.MustGetErrCode(sql, mysql.ErrDupEntry) + s.tk.MustGetErrCode(sql, errno.ErrDupEntry) sql = "alter table test_add_index_after_add_col add index idx_test(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17);" - s.tk.MustGetErrCode(sql, mysql.ErrTooManyKeyParts) + s.tk.MustGetErrCode(sql, errno.ErrTooManyKeyParts) } func (s *testIntegrationSuite3) TestResolveCharset(c *C) { @@ -1288,7 +1289,7 @@ func (s *testIntegrationSuite6) TestAddColumnTooMany(c *C) { s.tk.MustExec(createSQL) s.tk.MustExec("alter table t_column_too_many add column a_512 int") alterSQL := "alter table t_column_too_many add column a_513 int" - s.tk.MustGetErrCode(alterSQL, mysql.ErrTooManyFields) + s.tk.MustGetErrCode(alterSQL, errno.ErrTooManyFields) } func (s *testIntegrationSuite3) TestAlterColumn(c *C) { @@ -1344,13 +1345,13 @@ func (s *testIntegrationSuite3) TestAlterColumn(c *C) { // for failing tests sql := "alter table db_not_exist.test_alter_column alter column b set default 'c'" - s.tk.MustGetErrCode(sql, mysql.ErrNoSuchTable) + s.tk.MustGetErrCode(sql, errno.ErrNoSuchTable) sql = "alter table test_not_exist alter column b set default 'c'" - s.tk.MustGetErrCode(sql, mysql.ErrNoSuchTable) + s.tk.MustGetErrCode(sql, errno.ErrNoSuchTable) sql = "alter table test_alter_column alter column col_not_exist set default 'c'" - s.tk.MustGetErrCode(sql, mysql.ErrBadField) + s.tk.MustGetErrCode(sql, errno.ErrBadField) sql = "alter table test_alter_column alter column c set default null" - s.tk.MustGetErrCode(sql, mysql.ErrInvalidDefault) + s.tk.MustGetErrCode(sql, errno.ErrInvalidDefault) // The followings tests whether adding constraints via change / modify column // is forbidden as expected. @@ -1398,10 +1399,10 @@ func (s *testIntegrationSuite3) TestAlterColumn(c *C) { s.tk.MustExec("drop table if exists t") s.tk.MustExec("create table t1 (a varchar(10),b varchar(100),c tinyint,d varchar(3071),index(a),index(a,b),index (c,d)) charset = ascii;") - s.tk.MustGetErrCode("alter table t1 modify column a varchar(3000);", mysql.ErrTooLongKey) + s.tk.MustGetErrCode("alter table t1 modify column a varchar(3000);", errno.ErrTooLongKey) // check modify column with rename column. - s.tk.MustGetErrCode("alter table t1 change column a x varchar(3000);", mysql.ErrTooLongKey) - s.tk.MustGetErrCode("alter table t1 modify column c bigint;", mysql.ErrTooLongKey) + s.tk.MustGetErrCode("alter table t1 change column a x varchar(3000);", errno.ErrTooLongKey) + s.tk.MustGetErrCode("alter table t1 modify column c bigint;", errno.ErrTooLongKey) s.tk.MustExec("drop table if exists multi_unique") s.tk.MustExec("create table multi_unique (a int unique unique)") @@ -1429,7 +1430,7 @@ func (s *testIntegrationSuite) assertAlterWarnExec(c *C, sql string) { } func (s *testIntegrationSuite) assertAlterErrorExec(c *C, sql string) { - s.tk.MustGetErrCode(sql, mysql.ErrAlterOperationNotSupportedReason) + s.tk.MustGetErrCode(sql, errno.ErrAlterOperationNotSupportedReason) } func (s *testIntegrationSuite3) TestAlterAlgorithm(c *C) { @@ -1516,12 +1517,12 @@ func (s *testIntegrationSuite3) TestAlterTableAddUniqueOnPartionRangeColumn(c *C s.tk.MustExec("insert into t values (4, 'xxx', 4)") s.tk.MustExec("insert into t values (4, 'xxx', 9)") // Note the repeated 4 s.tk.MustExec("insert into t values (17, 'xxx', 12)") - s.tk.MustGetErrCode("alter table t add unique index idx_a(a)", mysql.ErrDupEntry) + s.tk.MustGetErrCode("alter table t add unique index idx_a(a)", errno.ErrDupEntry) s.tk.MustExec("delete from t where a = 4") s.tk.MustExec("alter table t add unique index idx_a(a)") s.tk.MustExec("alter table t add unique index idx_ac(a, c)") - s.tk.MustGetErrCode("alter table t add unique index idx_b(b)", mysql.ErrUniqueKeyNeedAllFieldsInPf) + s.tk.MustGetErrCode("alter table t add unique index idx_b(b)", errno.ErrUniqueKeyNeedAllFieldsInPf) } func (s *testIntegrationSuite5) TestFulltextIndexIgnore(c *C) { @@ -1550,7 +1551,7 @@ func (s *testIntegrationSuite1) TestTreatOldVersionUTF8AsUTF8MB4(c *C) { defer s.tk.MustExec("drop table if exists t") s.tk.MustExec("create table t (a varchar(10) character set utf8, b varchar(10) character set ascii) charset=utf8mb4;") - s.tk.MustGetErrCode("insert into t set a= x'f09f8c80';", mysql.ErrTruncatedWrongValueForField) + s.tk.MustGetErrCode("insert into t set a= x'f09f8c80';", errno.ErrTruncatedWrongValueForField) s.tk.MustQuery("show create table t").Check(testkit.Rows("t CREATE TABLE `t` (\n" + " `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,\n" + " `b` varchar(10) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL\n" + @@ -1588,7 +1589,7 @@ func (s *testIntegrationSuite1) TestTreatOldVersionUTF8AsUTF8MB4(c *C) { config.GetGlobalConfig().TreatOldVersionUTF8AsUTF8MB4 = false s.tk.MustExec("alter table t drop column c;") // reload schema. - s.tk.MustGetErrCode("insert into t set a= x'f09f8c80'", mysql.ErrTruncatedWrongValueForField) + s.tk.MustGetErrCode("insert into t set a= x'f09f8c80'", errno.ErrTruncatedWrongValueForField) s.tk.MustQuery("show create table t").Check(testkit.Rows("t CREATE TABLE `t` (\n" + " `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,\n" + " `b` varchar(10) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL\n" + @@ -1614,7 +1615,7 @@ func (s *testIntegrationSuite1) TestTreatOldVersionUTF8AsUTF8MB4(c *C) { config.GetGlobalConfig().TreatOldVersionUTF8AsUTF8MB4 = false s.tk.MustExec("alter table t drop column c;") // reload schema. - s.tk.MustGetErrCode("insert into t set a= x'f09f8c80'", mysql.ErrTruncatedWrongValueForField) + s.tk.MustGetErrCode("insert into t set a= x'f09f8c80'", errno.ErrTruncatedWrongValueForField) s.tk.MustQuery("show create table t").Check(testkit.Rows("t CREATE TABLE `t` (\n" + " `a` varchar(10) DEFAULT NULL,\n" + " `b` varchar(10) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL\n" + @@ -1659,7 +1660,7 @@ func (s *testIntegrationSuite1) TestTreatOldVersionUTF8AsUTF8MB4(c *C) { config.GetGlobalConfig().TreatOldVersionUTF8AsUTF8MB4 = false s.tk.MustExec("alter table t change column b b varchar(30) character set ascii") // reload schema. - s.tk.MustGetErrCode("insert into t set a= x'f09f8c80'", mysql.ErrTruncatedWrongValueForField) + s.tk.MustGetErrCode("insert into t set a= x'f09f8c80'", errno.ErrTruncatedWrongValueForField) s.tk.MustQuery("show create table t").Check(testkit.Rows("t CREATE TABLE `t` (\n" + " `a` varchar(20) DEFAULT NULL,\n" + " `b` varchar(30) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL\n" + @@ -1801,12 +1802,12 @@ func (s *testIntegrationSuite4) TestDropAutoIncrementIndex(c *C) { tk.MustExec("drop table if exists t1") tk.MustExec("create table t1 (a int auto_increment, unique key (a))") dropIndexSQL := "alter table t1 drop index a" - tk.MustGetErrCode(dropIndexSQL, mysql.ErrWrongAutoKey) + tk.MustGetErrCode(dropIndexSQL, errno.ErrWrongAutoKey) tk.MustExec("drop table if exists t1") tk.MustExec("create table t1 (a int(11) not null auto_increment, b int(11), c bigint, unique key (a, b, c))") dropIndexSQL = "alter table t1 drop index a" - tk.MustGetErrCode(dropIndexSQL, mysql.ErrWrongAutoKey) + tk.MustGetErrCode(dropIndexSQL, errno.ErrWrongAutoKey) } func (s *testIntegrationSuite4) TestInsertIntoGeneratedColumnWithDefaultExpr(c *C) { @@ -1862,7 +1863,7 @@ func (s *testIntegrationSuite4) TestInsertIntoGeneratedColumnWithDefaultExpr(c * // generated columns with default function is not allowed tk.MustExec("create table t5 (a int default 10, b int as (a+1))") - tk.MustGetErrCode("insert into t5 values (20, default(a))", mysql.ErrBadGeneratedColumn) + tk.MustGetErrCode("insert into t5 values (20, default(a))", errno.ErrBadGeneratedColumn) tk.MustExec("drop table t1, t2, t3, t4, t5") } @@ -1874,35 +1875,35 @@ func (s *testIntegrationSuite3) TestSqlFunctionsInGeneratedColumns(c *C) { tk.MustExec("drop table if exists t, t1") // In generated columns expression, these items are not allowed: - // 1. Blocked function (for full function list, please visit https://github.com/mysql/mysql-server/blob/5.7/mysql-test/suite/gcol/inc/gcol_blocked_sql_funcs_main.inc) - // Note: This list is not complete, if you need a complete list, please refer to MySQL 5.7 source code. - tk.MustGetErrCode("create table t (a int, b int as (sysdate()))", mysql.ErrGeneratedColumnFunctionIsNotAllowed) + // 1. Blocked function (for full function list, please visit https://github.com/errno/errno-server/blob/5.7/errno-test/suite/gcol/inc/gcol_blocked_sql_funcs_main.inc) + // Note: This list is not complete, if you need a complete list, please refer to Errno 5.7 source code. + tk.MustGetErrCode("create table t (a int, b int as (sysdate()))", errno.ErrGeneratedColumnFunctionIsNotAllowed) // 2. Non-builtin function - tk.MustGetErrCode("create table t (a int, b int as (non_exist_funcA()))", mysql.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode("create table t (a int, b int as (non_exist_funcA()))", errno.ErrGeneratedColumnFunctionIsNotAllowed) // 3. values(x) function - tk.MustGetErrCode("create table t (a int, b int as (values(a)))", mysql.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode("create table t (a int, b int as (values(a)))", errno.ErrGeneratedColumnFunctionIsNotAllowed) // 4. Subquery - tk.MustGetErrCode("create table t (a int, b int as ((SELECT 1 FROM t1 UNION SELECT 1 FROM t1)))", mysql.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode("create table t (a int, b int as ((SELECT 1 FROM t1 UNION SELECT 1 FROM t1)))", errno.ErrGeneratedColumnFunctionIsNotAllowed) // 5. Variable & functions related to variable tk.MustExec("set @x = 1") - tk.MustGetErrCode("create table t (a int, b int as (@x))", mysql.ErrGeneratedColumnFunctionIsNotAllowed) - tk.MustGetErrCode("create table t (a int, b int as (@@max_connections))", mysql.ErrGeneratedColumnFunctionIsNotAllowed) - tk.MustGetErrCode("create table t (a int, b int as (@y:=1))", mysql.ErrGeneratedColumnFunctionIsNotAllowed) - tk.MustGetErrCode(`create table t (a int, b int as (getvalue("x")))`, mysql.ErrGeneratedColumnFunctionIsNotAllowed) - tk.MustGetErrCode(`create table t (a int, b int as (setvalue("y", 1)))`, mysql.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode("create table t (a int, b int as (@x))", errno.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode("create table t (a int, b int as (@@max_connections))", errno.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode("create table t (a int, b int as (@y:=1))", errno.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode(`create table t (a int, b int as (getvalue("x")))`, errno.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode(`create table t (a int, b int as (setvalue("y", 1)))`, errno.ErrGeneratedColumnFunctionIsNotAllowed) // 6. Aggregate function - tk.MustGetErrCode("create table t1 (a int, b int as (avg(a)));", mysql.ErrInvalidGroupFuncUse) + tk.MustGetErrCode("create table t1 (a int, b int as (avg(a)));", errno.ErrInvalidGroupFuncUse) // Determinate functions are allowed: tk.MustExec("create table t1 (a int, b int generated always as (abs(a)) virtual)") tk.MustExec("insert into t1 values (-1, default)") tk.MustQuery("select * from t1").Check(testkit.Rows("-1 1")) - // Functions added in MySQL 8.0, but now not supported in TiDB + // Functions added in Errno 8.0, but now not supported in TiDB // They will be deal with non-exists function, and throw error.git - tk.MustGetErrCode("create table t (a int, b int as (updatexml(1, 1, 1)))", mysql.ErrGeneratedColumnFunctionIsNotAllowed) - tk.MustGetErrCode("create table t (a int, b int as (statement_digest(1)))", mysql.ErrGeneratedColumnFunctionIsNotAllowed) - tk.MustGetErrCode("create table t (a int, b int as (statement_digest_text(1)))", mysql.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode("create table t (a int, b int as (updatexml(1, 1, 1)))", errno.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode("create table t (a int, b int as (statement_digest(1)))", errno.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode("create table t (a int, b int as (statement_digest_text(1)))", errno.ErrGeneratedColumnFunctionIsNotAllowed) } func (s *testIntegrationSuite3) TestParserIssue284(c *C) { @@ -1921,7 +1922,7 @@ func (s *testIntegrationSuite6) TestAddExpressionIndex(c *C) { tk.MustExec("use test") tk.MustExec("drop table if exists t;") - tk.MustGetErrCode("create table t(a int, b int, index((a+b)));", mysql.ErrNotSupportedYet) + tk.MustGetErrCode("create table t(a int, b int, index((a+b)));", errno.ErrNotSupportedYet) tk.MustExec("create table t (a int, b real);") tk.MustExec("insert into t values (1, 2.1);") @@ -1967,29 +1968,29 @@ func (s *testIntegrationSuite6) TestCreateExpressionIndexError(c *C) { tk.MustExec("use test") tk.MustExec("drop table if exists t;") tk.MustExec("create table t (a int, b real);") - tk.MustGetErrCode("alter table t add primary key ((a+b));", mysql.ErrFunctionalIndexPrimaryKey) + tk.MustGetErrCode("alter table t add primary key ((a+b));", errno.ErrFunctionalIndexPrimaryKey) // Test for error tk.MustExec("drop table if exists t;") tk.MustExec("create table t (a int, b real);") - tk.MustGetErrCode("alter table t add primary key ((a+b));", mysql.ErrFunctionalIndexPrimaryKey) - tk.MustGetErrCode("alter table t add index ((rand()));", mysql.ErrGeneratedColumnFunctionIsNotAllowed) - tk.MustGetErrCode("alter table t add index ((now()+1));", mysql.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode("alter table t add primary key ((a+b));", errno.ErrFunctionalIndexPrimaryKey) + tk.MustGetErrCode("alter table t add index ((rand()));", errno.ErrGeneratedColumnFunctionIsNotAllowed) + tk.MustGetErrCode("alter table t add index ((now()+1));", errno.ErrGeneratedColumnFunctionIsNotAllowed) tk.MustExec("alter table t add column (_V$_idx_0 int);") - tk.MustGetErrCode("alter table t add index idx((a+1));", mysql.ErrDupFieldName) + tk.MustGetErrCode("alter table t add index idx((a+1));", errno.ErrDupFieldName) tk.MustExec("alter table t drop column _V$_idx_0;") tk.MustExec("alter table t add index idx((a+1));") - tk.MustGetErrCode("alter table t add column (_V$_idx_0 int);", mysql.ErrDupFieldName) + tk.MustGetErrCode("alter table t add column (_V$_idx_0 int);", errno.ErrDupFieldName) tk.MustExec("alter table t drop index idx;") tk.MustExec("alter table t add column (_V$_idx_0 int);") tk.MustExec("alter table t add column (_V$_expression_index_0 int);") - tk.MustGetErrCode("alter table t add index ((a+1));", mysql.ErrDupFieldName) + tk.MustGetErrCode("alter table t add index ((a+1));", errno.ErrDupFieldName) tk.MustExec("alter table t drop column _V$_expression_index_0;") tk.MustExec("alter table t add index ((a+1));") - tk.MustGetErrCode("alter table t drop column _V$_expression_index_0;", mysql.ErrCantDropFieldOrKey) - tk.MustGetErrCode("alter table t add column e int as (_V$_expression_index_0 + 1);", mysql.ErrBadField) + tk.MustGetErrCode("alter table t drop column _V$_expression_index_0;", errno.ErrCantDropFieldOrKey) + tk.MustGetErrCode("alter table t add column e int as (_V$_expression_index_0 + 1);", errno.ErrBadField) } func (s *testIntegrationSuite6) TestAddExpressionIndexOnPartition(c *C) { diff --git a/ddl/db_test.go b/ddl/db_test.go index 4735916071c8c..d470a78a7d127 100644 --- a/ddl/db_test.go +++ b/ddl/db_test.go @@ -34,6 +34,7 @@ import ( "github.com/pingcap/tidb/ddl" testddlutil "github.com/pingcap/tidb/ddl/testutil" "github.com/pingcap/tidb/domain" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" @@ -173,13 +174,13 @@ func (s *testDBSuite1) TestRenameIndex(c *C) { s.tk.MustExec("admin check index t k3") // Test rename on non-exists keys - s.tk.MustGetErrCode("alter table t rename index x to x", mysql.ErrKeyDoesNotExist) + s.tk.MustGetErrCode("alter table t rename index x to x", errno.ErrKeyDoesNotExist) // Test rename on already-exists keys - s.tk.MustGetErrCode("alter table t rename index k3 to k2", mysql.ErrDupKeyName) + s.tk.MustGetErrCode("alter table t rename index k3 to k2", errno.ErrDupKeyName) s.tk.MustExec("alter table t rename index k2 to K2") - s.tk.MustGetErrCode("alter table t rename key k3 to K2", mysql.ErrDupKeyName) + s.tk.MustGetErrCode("alter table t rename key k3 to K2", errno.ErrDupKeyName) } func testGetTableByName(c *C, ctx sessionctx.Context, db, table string) table.Table { @@ -1426,7 +1427,7 @@ func (s *testDBSuite5) TestAlterPrimaryKey(c *C) { defer s.tk.MustExec("drop table test_add_pk") // for generated columns - s.tk.MustGetErrCode("alter table test_add_pk add primary key(d);", mysql.ErrUnsupportedOnGeneratedColumn) + s.tk.MustGetErrCode("alter table test_add_pk add primary key(d);", errno.ErrUnsupportedOnGeneratedColumn) // The primary key name is the same as the existing index name. s.tk.MustExec("alter table test_add_pk add primary key idx(e)") s.tk.MustExec("drop index `primary` on test_add_pk") @@ -1456,29 +1457,29 @@ func (s *testDBSuite5) TestAlterPrimaryKey(c *C) { "[b int(11) NO ")) // Check if the primary key exists before checking the table's pkIsHandle. - s.tk.MustGetErrCode("alter table test_add_pk drop primary key", mysql.ErrCantDropFieldOrKey) + s.tk.MustGetErrCode("alter table test_add_pk drop primary key", errno.ErrCantDropFieldOrKey) // for the limit of name validName := strings.Repeat("a", mysql.MaxIndexIdentifierLen) invalidName := strings.Repeat("b", mysql.MaxIndexIdentifierLen+1) - s.tk.MustGetErrCode("alter table test_add_pk add primary key "+invalidName+"(a)", mysql.ErrTooLongIdent) + s.tk.MustGetErrCode("alter table test_add_pk add primary key "+invalidName+"(a)", errno.ErrTooLongIdent) // for valid name s.tk.MustExec("alter table test_add_pk add primary key " + validName + "(a)") // for multiple primary key - s.tk.MustGetErrCode("alter table test_add_pk add primary key (a)", mysql.ErrMultiplePriKey) + s.tk.MustGetErrCode("alter table test_add_pk add primary key (a)", errno.ErrMultiplePriKey) s.tk.MustExec("alter table test_add_pk drop primary key") // for not existing primary key - s.tk.MustGetErrCode("alter table test_add_pk drop primary key", mysql.ErrCantDropFieldOrKey) - s.tk.MustGetErrCode("drop index `primary` on test_add_pk", mysql.ErrCantDropFieldOrKey) + s.tk.MustGetErrCode("alter table test_add_pk drop primary key", errno.ErrCantDropFieldOrKey) + s.tk.MustGetErrCode("drop index `primary` on test_add_pk", errno.ErrCantDropFieldOrKey) // for too many key parts specified s.tk.MustGetErrCode("alter table test_add_pk add primary key idx_test(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17);", - mysql.ErrTooManyKeyParts) + errno.ErrTooManyKeyParts) // for the limit of comment's length validComment := "'" + strings.Repeat("a", ddl.MaxCommentLength) + "'" invalidComment := "'" + strings.Repeat("b", ddl.MaxCommentLength+1) + "'" - s.tk.MustGetErrCode("alter table test_add_pk add primary key(a) comment "+invalidComment, mysql.ErrTooLongIndexComment) + s.tk.MustGetErrCode("alter table test_add_pk add primary key(a) comment "+invalidComment, errno.ErrTooLongIndexComment) // for empty sql_mode r := s.tk.MustQuery("select @@sql_mode") sqlMode := r.Rows()[0][0].(string) @@ -1506,11 +1507,11 @@ func (s *testDBSuite5) TestAlterPrimaryKey(c *C) { s.tk.MustExec("create table test_add_pk(a int, b int unsigned , c varchar(255) default 'abc', index idx(b))") s.tk.MustExec("insert into test_add_pk set a = 0, b = 0, c = 0") s.tk.MustExec("insert into test_add_pk set a = 1") - s.tk.MustGetErrCode("alter table test_add_pk add primary key (b)", mysql.ErrInvalidUseOfNull) + s.tk.MustGetErrCode("alter table test_add_pk add primary key (b)", errno.ErrInvalidUseOfNull) s.tk.MustExec("insert into test_add_pk set a = 2, b = 2") - s.tk.MustGetErrCode("alter table test_add_pk add primary key (a, b)", mysql.ErrInvalidUseOfNull) + s.tk.MustGetErrCode("alter table test_add_pk add primary key (a, b)", errno.ErrInvalidUseOfNull) s.tk.MustExec("insert into test_add_pk set a = 3, c = 3") - s.tk.MustGetErrCode("alter table test_add_pk add primary key (c, b, a)", mysql.ErrInvalidUseOfNull) + s.tk.MustGetErrCode("alter table test_add_pk add primary key (c, b, a)", errno.ErrInvalidUseOfNull) } func (s *testDBSuite4) TestAddIndexWithDupCols(c *C) { @@ -1852,23 +1853,23 @@ func (s *testDBSuite4) TestChangeColumn(c *C) { // for failing tests sql := "alter table t3 change aa a bigint default ''" - s.tk.MustGetErrCode(sql, mysql.ErrInvalidDefault) + s.tk.MustGetErrCode(sql, errno.ErrInvalidDefault) sql = "alter table t3 change a testx.t3.aa bigint" - s.tk.MustGetErrCode(sql, mysql.ErrWrongDBName) + s.tk.MustGetErrCode(sql, errno.ErrWrongDBName) sql = "alter table t3 change t.a aa bigint" - s.tk.MustGetErrCode(sql, mysql.ErrWrongTableName) + s.tk.MustGetErrCode(sql, errno.ErrWrongTableName) s.mustExec(c, "create table t4 (c1 int, c2 int, c3 int default 1, index (c1));") s.tk.MustExec("insert into t4(c2) values (null);") sql = "alter table t4 change c1 a1 int not null;" - s.tk.MustGetErrCode(sql, mysql.ErrInvalidUseOfNull) + s.tk.MustGetErrCode(sql, errno.ErrInvalidUseOfNull) sql = "alter table t4 change c2 a bigint not null;" s.tk.MustGetErrCode(sql, mysql.WarnDataTruncated) sql = "alter table t3 modify en enum('a', 'z', 'b', 'c') not null default 'a'" - s.tk.MustGetErrCode(sql, mysql.ErrUnsupportedDDLOperation) + s.tk.MustGetErrCode(sql, errno.ErrUnsupportedDDLOperation) // Rename to an existing column. s.mustExec(c, "alter table t3 add column a bigint") sql = "alter table t3 change aa a bigint" - s.tk.MustGetErrCode(sql, mysql.ErrDupFieldName) + s.tk.MustGetErrCode(sql, errno.ErrDupFieldName) s.tk.MustExec("drop table t3") } @@ -1892,17 +1893,17 @@ func (s *testDBSuite5) TestRenameColumn(c *C) { assertColNames("test_rename_column", "id", "col2") // Test renaming non-exist columns. - s.tk.MustGetErrCode("alter table test_rename_column rename column non_exist_col to col3", mysql.ErrBadField) + s.tk.MustGetErrCode("alter table test_rename_column rename column non_exist_col to col3", errno.ErrBadField) // Test renaming to an exist column. - s.tk.MustGetErrCode("alter table test_rename_column rename column col2 to id", mysql.ErrDupFieldName) + s.tk.MustGetErrCode("alter table test_rename_column rename column col2 to id", errno.ErrDupFieldName) // Test renaming the column with foreign key. s.tk.MustExec("drop table test_rename_column") s.tk.MustExec("create table test_rename_column_base (base int)") s.tk.MustExec("create table test_rename_column (col int, foreign key (col) references test_rename_column_base(base))") - s.tk.MustGetErrCode("alter table test_rename_column rename column col to col1", mysql.ErrFKIncompatibleColumns) + s.tk.MustGetErrCode("alter table test_rename_column rename column col to col1", errno.ErrFKIncompatibleColumns) s.tk.MustExec("drop table test_rename_column_base") @@ -1914,7 +1915,7 @@ func (s *testDBSuite5) TestRenameColumn(c *C) { assertColNames("test_rename_column", "id", "col2") s.mustExec(c, "alter table test_rename_column rename column col2 to col1") assertColNames("test_rename_column", "id", "col1") - s.tk.MustGetErrCode("alter table test_rename_column rename column id to id1", mysql.ErrBadField) + s.tk.MustGetErrCode("alter table test_rename_column rename column id to id1", errno.ErrBadField) // Test renaming view columns. s.tk.MustExec("drop table test_rename_column") @@ -1922,7 +1923,7 @@ func (s *testDBSuite5) TestRenameColumn(c *C) { s.mustExec(c, "create view test_rename_column_view as select * from test_rename_column") s.mustExec(c, "alter table test_rename_column rename column col1 to col2") - s.tk.MustGetErrCode("select * from test_rename_column_view", mysql.ErrViewInvalid) + s.tk.MustGetErrCode("select * from test_rename_column_view", errno.ErrViewInvalid) s.mustExec(c, "drop view test_rename_column_view") s.tk.MustExec("drop table test_rename_column") @@ -2073,14 +2074,14 @@ func (s *testDBSuite1) TestCreateTable(c *C) { s.tk.MustExec("drop table t") - s.tk.MustGetErrCode("CREATE TABLE `t` (`a` int) DEFAULT CHARSET=abcdefg", mysql.ErrUnknownCharacterSet) + s.tk.MustGetErrCode("CREATE TABLE `t` (`a` int) DEFAULT CHARSET=abcdefg", errno.ErrUnknownCharacterSet) s.tk.MustExec("CREATE TABLE `collateTest` (`a` int, `b` varchar(10)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci") expects := "CREATE TABLE `collateTest` (\n `a` int(11) DEFAULT NULL,\n `b` varchar(10) COLLATE utf8_slovak_ci DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci" s.tk.MustQuery("show create table collateTest").Check(testkit.Rows(expects)) - s.tk.MustGetErrCode("CREATE TABLE `collateTest2` (`a` int) CHARSET utf8 COLLATE utf8mb4_unicode_ci", mysql.ErrCollationCharsetMismatch) - s.tk.MustGetErrCode("CREATE TABLE `collateTest3` (`a` int) COLLATE utf8mb4_unicode_ci CHARSET utf8", mysql.ErrConflictingDeclarations) + s.tk.MustGetErrCode("CREATE TABLE `collateTest2` (`a` int) CHARSET utf8 COLLATE utf8mb4_unicode_ci", errno.ErrCollationCharsetMismatch) + s.tk.MustGetErrCode("CREATE TABLE `collateTest3` (`a` int) COLLATE utf8mb4_unicode_ci CHARSET utf8", errno.ErrConflictingDeclarations) s.tk.MustExec("CREATE TABLE `collateTest4` (`a` int) COLLATE utf8_uniCOde_ci") expects = "CREATE TABLE `collateTest4` (\n `a` int(11) DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" @@ -2095,18 +2096,18 @@ func (s *testDBSuite1) TestCreateTable(c *C) { // test for enum column s.tk.MustExec("use test") failSQL := "create table t_enum (a enum('e','e'));" - s.tk.MustGetErrCode(failSQL, mysql.ErrDuplicatedValueInType) + s.tk.MustGetErrCode(failSQL, errno.ErrDuplicatedValueInType) failSQL = "create table t_enum (a enum('e','E'));" - s.tk.MustGetErrCode(failSQL, mysql.ErrDuplicatedValueInType) + s.tk.MustGetErrCode(failSQL, errno.ErrDuplicatedValueInType) failSQL = "create table t_enum (a enum('abc','Abc'));" - s.tk.MustGetErrCode(failSQL, mysql.ErrDuplicatedValueInType) + s.tk.MustGetErrCode(failSQL, errno.ErrDuplicatedValueInType) // test for set column failSQL = "create table t_enum (a set('e','e'));" - s.tk.MustGetErrCode(failSQL, mysql.ErrDuplicatedValueInType) + s.tk.MustGetErrCode(failSQL, errno.ErrDuplicatedValueInType) failSQL = "create table t_enum (a set('e','E'));" - s.tk.MustGetErrCode(failSQL, mysql.ErrDuplicatedValueInType) + s.tk.MustGetErrCode(failSQL, errno.ErrDuplicatedValueInType) failSQL = "create table t_enum (a set('abc','Abc'));" - s.tk.MustGetErrCode(failSQL, mysql.ErrDuplicatedValueInType) + s.tk.MustGetErrCode(failSQL, errno.ErrDuplicatedValueInType) _, err = s.tk.Exec("create table t_enum (a enum('B','b'));") c.Assert(err.Error(), Equals, "[types:1291]Column 'a' has duplicated value 'B' in ENUM") } @@ -2363,16 +2364,16 @@ func (s *testDBSuite2) TestCreateTableWithSetCol(c *C) { // The type of default value is string. s.tk.MustExec("drop table t_set") failedSQL := "create table t_set (a set('1', '4', '10') default '3');" - s.tk.MustGetErrCode(failedSQL, mysql.ErrInvalidDefault) + s.tk.MustGetErrCode(failedSQL, errno.ErrInvalidDefault) failedSQL = "create table t_set (a set('1', '4', '10') default '1,4,11');" - s.tk.MustGetErrCode(failedSQL, mysql.ErrInvalidDefault) + s.tk.MustGetErrCode(failedSQL, errno.ErrInvalidDefault) failedSQL = "create table t_set (a set('1', '4', '10') default '1 ,4');" - s.tk.MustGetErrCode(failedSQL, mysql.ErrInvalidDefault) + s.tk.MustGetErrCode(failedSQL, errno.ErrInvalidDefault) // The type of default value is int. failedSQL = "create table t_set (a set('1', '4', '10') default 0);" - s.tk.MustGetErrCode(failedSQL, mysql.ErrInvalidDefault) + s.tk.MustGetErrCode(failedSQL, errno.ErrInvalidDefault) failedSQL = "create table t_set (a set('1', '4', '10') default 8);" - s.tk.MustGetErrCode(failedSQL, mysql.ErrInvalidDefault) + s.tk.MustGetErrCode(failedSQL, errno.ErrInvalidDefault) // The type of default value is int. // It's for successful cases @@ -2405,24 +2406,24 @@ func (s *testDBSuite2) TestTableForeignKey(c *C) { s.tk.MustExec("create table t1 (a int, b int);") // test create table with foreign key. failSQL := "create table t2 (c int, foreign key (a) references t1(a));" - s.tk.MustGetErrCode(failSQL, mysql.ErrKeyColumnDoesNotExits) + s.tk.MustGetErrCode(failSQL, errno.ErrKeyColumnDoesNotExits) // test add foreign key. s.tk.MustExec("create table t3 (a int, b int);") failSQL = "alter table t1 add foreign key (c) REFERENCES t3(a);" - s.tk.MustGetErrCode(failSQL, mysql.ErrKeyColumnDoesNotExits) + s.tk.MustGetErrCode(failSQL, errno.ErrKeyColumnDoesNotExits) // test oreign key not match error failSQL = "alter table t1 add foreign key (a) REFERENCES t3(a, b);" - s.tk.MustGetErrCode(failSQL, mysql.ErrWrongFkDef) + s.tk.MustGetErrCode(failSQL, errno.ErrWrongFkDef) // Test drop column with foreign key. s.tk.MustExec("create table t4 (c int,d int,foreign key (d) references t1 (b));") failSQL = "alter table t4 drop column d" - s.tk.MustGetErrCode(failSQL, mysql.ErrFkColumnCannotDrop) + s.tk.MustGetErrCode(failSQL, errno.ErrFkColumnCannotDrop) // Test change column with foreign key. failSQL = "alter table t4 change column d e bigint;" - s.tk.MustGetErrCode(failSQL, mysql.ErrFKIncompatibleColumns) + s.tk.MustGetErrCode(failSQL, errno.ErrFKIncompatibleColumns) // Test modify column with foreign key. failSQL = "alter table t4 modify column d bigint;" - s.tk.MustGetErrCode(failSQL, mysql.ErrFKIncompatibleColumns) + s.tk.MustGetErrCode(failSQL, errno.ErrFKIncompatibleColumns) s.tk.MustQuery("select count(*) from information_schema.KEY_COLUMN_USAGE;") s.tk.MustExec("alter table t4 drop foreign key d") s.tk.MustExec("alter table t4 modify column d bigint;") @@ -2436,9 +2437,9 @@ func (s *testDBSuite3) TestFKOnGeneratedColumns(c *C) { // foreign key constraint cannot be defined on a virtual generated column. s.tk.MustExec("create table t1 (a int primary key);") - s.tk.MustGetErrCode("create table t2 (a int, b int as (a+1) virtual, foreign key (b) references t1(a));", mysql.ErrCannotAddForeign) + s.tk.MustGetErrCode("create table t2 (a int, b int as (a+1) virtual, foreign key (b) references t1(a));", errno.ErrCannotAddForeign) s.tk.MustExec("create table t2 (a int, b int generated always as (a+1) virtual);") - s.tk.MustGetErrCode("alter table t2 add foreign key (b) references t1(a);", mysql.ErrCannotAddForeign) + s.tk.MustGetErrCode("alter table t2 add foreign key (b) references t1(a);", errno.ErrCannotAddForeign) s.tk.MustExec("drop table t1, t2;") // foreign key constraint can be defined on a stored generated column. @@ -2456,31 +2457,31 @@ func (s *testDBSuite3) TestFKOnGeneratedColumns(c *C) { s.tk.MustExec("drop table t1, t2, t3;") // rejected FK options on stored generated columns - s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on update set null);", mysql.ErrWrongFKOptionForGeneratedColumn) - s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on update cascade);", mysql.ErrWrongFKOptionForGeneratedColumn) - s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on update set default);", mysql.ErrWrongFKOptionForGeneratedColumn) - s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on delete set null);", mysql.ErrWrongFKOptionForGeneratedColumn) - s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on delete set default);", mysql.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on update set null);", errno.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on update cascade);", errno.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on update set default);", errno.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on delete set null);", errno.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on delete set default);", errno.ErrWrongFKOptionForGeneratedColumn) s.tk.MustExec("create table t2 (a int primary key);") s.tk.MustExec("create table t1 (a int, b int generated always as (a+1) stored);") - s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on update set null;", mysql.ErrWrongFKOptionForGeneratedColumn) - s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on update cascade;", mysql.ErrWrongFKOptionForGeneratedColumn) - s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on update set default;", mysql.ErrWrongFKOptionForGeneratedColumn) - s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on delete set null;", mysql.ErrWrongFKOptionForGeneratedColumn) - s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on delete set default;", mysql.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on update set null;", errno.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on update cascade;", errno.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on update set default;", errno.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on delete set null;", errno.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on delete set default;", errno.ErrWrongFKOptionForGeneratedColumn) s.tk.MustExec("drop table t1, t2;") // column name with uppercase characters - s.tk.MustGetErrCode("create table t1 (A int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on update set null);", mysql.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("create table t1 (A int, b int generated always as (a+1) stored, foreign key (b) references t2(a) on update set null);", errno.ErrWrongFKOptionForGeneratedColumn) s.tk.MustExec("create table t2 (a int primary key);") s.tk.MustExec("create table t1 (A int, b int generated always as (a+1) stored);") - s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on update set null;", mysql.ErrWrongFKOptionForGeneratedColumn) + s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on update set null;", errno.ErrWrongFKOptionForGeneratedColumn) s.tk.MustExec("drop table t1, t2;") // special case: TiDB error different from MySQL 8.0 // MySQL: ERROR 3104 (HY000): Cannot define foreign key with ON UPDATE SET NULL clause on a generated column. // TiDB: ERROR 1146 (42S02): Table 'test.t2' doesn't exist s.tk.MustExec("create table t1 (a int, b int generated always as (a+1) stored);") - s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on update set null;", mysql.ErrNoSuchTable) + s.tk.MustGetErrCode("alter table t1 add foreign key (b) references t2(a) on update set null;", errno.ErrNoSuchTable) s.tk.MustExec("drop table t1;") // allowed FK options on stored generated columns @@ -2505,19 +2506,19 @@ func (s *testDBSuite3) TestFKOnGeneratedColumns(c *C) { // rejected FK options on the base columns of a stored generated columns s.tk.MustExec("create table t2 (a int primary key);") - s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on update set null);", mysql.ErrCannotAddForeign) - s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on update cascade);", mysql.ErrCannotAddForeign) - s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on update set default);", mysql.ErrCannotAddForeign) - s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on delete set null);", mysql.ErrCannotAddForeign) - s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on delete cascade);", mysql.ErrCannotAddForeign) - s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on delete set default);", mysql.ErrCannotAddForeign) + s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on update set null);", errno.ErrCannotAddForeign) + s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on update cascade);", errno.ErrCannotAddForeign) + s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on update set default);", errno.ErrCannotAddForeign) + s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on delete set null);", errno.ErrCannotAddForeign) + s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on delete cascade);", errno.ErrCannotAddForeign) + s.tk.MustGetErrCode("create table t1 (a int, b int generated always as (a+1) stored, foreign key (a) references t2(a) on delete set default);", errno.ErrCannotAddForeign) s.tk.MustExec("create table t1 (a int, b int generated always as (a+1) stored);") - s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on update set null;", mysql.ErrCannotAddForeign) - s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on update cascade;", mysql.ErrCannotAddForeign) - s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on update set default;", mysql.ErrCannotAddForeign) - s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on delete set null;", mysql.ErrCannotAddForeign) - s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on delete cascade;", mysql.ErrCannotAddForeign) - s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on delete set default;", mysql.ErrCannotAddForeign) + s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on update set null;", errno.ErrCannotAddForeign) + s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on update cascade;", errno.ErrCannotAddForeign) + s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on update set default;", errno.ErrCannotAddForeign) + s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on delete set null;", errno.ErrCannotAddForeign) + s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on delete cascade;", errno.ErrCannotAddForeign) + s.tk.MustGetErrCode("alter table t1 add foreign key (a) references t2(a) on delete set default;", errno.ErrCannotAddForeign) s.tk.MustExec("drop table t1, t2;") // allowed FK options on the base columns of a stored generated columns @@ -2686,46 +2687,46 @@ func (s *testDBSuite) testRenameTable(c *C, sql string, isAlterTable bool) { // for failure case failSQL := fmt.Sprintf(sql, "test_not_exist.t", "test_not_exist.t") if isAlterTable { - s.tk.MustGetErrCode(failSQL, mysql.ErrNoSuchTable) + s.tk.MustGetErrCode(failSQL, errno.ErrNoSuchTable) } else { - s.tk.MustGetErrCode(failSQL, mysql.ErrFileNotFound) + s.tk.MustGetErrCode(failSQL, errno.ErrFileNotFound) } failSQL = fmt.Sprintf(sql, "test.test_not_exist", "test.test_not_exist") if isAlterTable { - s.tk.MustGetErrCode(failSQL, mysql.ErrNoSuchTable) + s.tk.MustGetErrCode(failSQL, errno.ErrNoSuchTable) } else { - s.tk.MustGetErrCode(failSQL, mysql.ErrFileNotFound) + s.tk.MustGetErrCode(failSQL, errno.ErrFileNotFound) } failSQL = fmt.Sprintf(sql, "test.t_not_exist", "test_not_exist.t") if isAlterTable { - s.tk.MustGetErrCode(failSQL, mysql.ErrNoSuchTable) + s.tk.MustGetErrCode(failSQL, errno.ErrNoSuchTable) } else { - s.tk.MustGetErrCode(failSQL, mysql.ErrFileNotFound) + s.tk.MustGetErrCode(failSQL, errno.ErrFileNotFound) } failSQL = fmt.Sprintf(sql, "test1.t2", "test_not_exist.t") - s.tk.MustGetErrCode(failSQL, mysql.ErrErrorOnRename) + s.tk.MustGetErrCode(failSQL, errno.ErrErrorOnRename) s.tk.MustExec("use test1") s.tk.MustExec("create table if not exists t_exist (c1 int, c2 int)") failSQL = fmt.Sprintf(sql, "test1.t2", "test1.t_exist") - s.tk.MustGetErrCode(failSQL, mysql.ErrTableExists) + s.tk.MustGetErrCode(failSQL, errno.ErrTableExists) failSQL = fmt.Sprintf(sql, "test.t_not_exist", "test1.t_exist") if isAlterTable { - s.tk.MustGetErrCode(failSQL, mysql.ErrNoSuchTable) + s.tk.MustGetErrCode(failSQL, errno.ErrNoSuchTable) } else { - s.tk.MustGetErrCode(failSQL, mysql.ErrTableExists) + s.tk.MustGetErrCode(failSQL, errno.ErrTableExists) } failSQL = fmt.Sprintf(sql, "test_not_exist.t", "test1.t_exist") if isAlterTable { - s.tk.MustGetErrCode(failSQL, mysql.ErrNoSuchTable) + s.tk.MustGetErrCode(failSQL, errno.ErrNoSuchTable) } else { - s.tk.MustGetErrCode(failSQL, mysql.ErrTableExists) + s.tk.MustGetErrCode(failSQL, errno.ErrTableExists) } failSQL = fmt.Sprintf(sql, "test_not_exist.t", "test1.t_not_exist") if isAlterTable { - s.tk.MustGetErrCode(failSQL, mysql.ErrNoSuchTable) + s.tk.MustGetErrCode(failSQL, errno.ErrNoSuchTable) } else { - s.tk.MustGetErrCode(failSQL, mysql.ErrFileNotFound) + s.tk.MustGetErrCode(failSQL, errno.ErrFileNotFound) } // for the same table name @@ -2736,13 +2737,13 @@ func (s *testDBSuite) testRenameTable(c *C, sql string, isAlterTable bool) { s.tk.MustExec(fmt.Sprintf(sql, "test1.t", "t")) s.tk.MustExec(fmt.Sprintf(sql, "test1.t1", "test1.T1")) } else { - s.tk.MustGetErrCode(fmt.Sprintf(sql, "test1.t", "t"), mysql.ErrTableExists) - s.tk.MustGetErrCode(fmt.Sprintf(sql, "test1.t1", "test1.T1"), mysql.ErrTableExists) + s.tk.MustGetErrCode(fmt.Sprintf(sql, "test1.t", "t"), errno.ErrTableExists) + s.tk.MustGetErrCode(fmt.Sprintf(sql, "test1.t1", "test1.T1"), errno.ErrTableExists) } // Test rename table name too long. - s.tk.MustGetErrCode("rename table test1.t1 to test1.txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", mysql.ErrTooLongIdent) - s.tk.MustGetErrCode("alter table test1.t1 rename to test1.txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", mysql.ErrTooLongIdent) + s.tk.MustGetErrCode("rename table test1.t1 to test1.txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", errno.ErrTooLongIdent) + s.tk.MustGetErrCode("alter table test1.t1 rename to test1.txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", errno.ErrTooLongIdent) s.tk.MustExec("drop database test1") } @@ -2845,31 +2846,31 @@ func (s *testDBSuite3) TestGeneratedColumnDDL(c *C) { err int }{ // Drop/rename columns dependent by other column. - {`alter table test_gv_ddl drop column a`, mysql.ErrDependentByGeneratedColumn}, - {`alter table test_gv_ddl change column a anew int`, mysql.ErrBadField}, + {`alter table test_gv_ddl drop column a`, errno.ErrDependentByGeneratedColumn}, + {`alter table test_gv_ddl change column a anew int`, errno.ErrBadField}, // Modify/change stored status of generated columns. - {`alter table test_gv_ddl modify column b bigint`, mysql.ErrUnsupportedOnGeneratedColumn}, - {`alter table test_gv_ddl change column c cnew bigint as (a+100)`, mysql.ErrUnsupportedOnGeneratedColumn}, + {`alter table test_gv_ddl modify column b bigint`, errno.ErrUnsupportedOnGeneratedColumn}, + {`alter table test_gv_ddl change column c cnew bigint as (a+100)`, errno.ErrUnsupportedOnGeneratedColumn}, // Modify/change generated columns breaking prior. - {`alter table test_gv_ddl modify column b int as (c+100)`, mysql.ErrGeneratedColumnNonPrior}, - {`alter table test_gv_ddl change column b bnew int as (c+100)`, mysql.ErrGeneratedColumnNonPrior}, + {`alter table test_gv_ddl modify column b int as (c+100)`, errno.ErrGeneratedColumnNonPrior}, + {`alter table test_gv_ddl change column b bnew int as (c+100)`, errno.ErrGeneratedColumnNonPrior}, // Refer not exist columns in generation expression. - {`create table test_gv_ddl_bad (a int, b int as (c+8))`, mysql.ErrBadField}, + {`create table test_gv_ddl_bad (a int, b int as (c+8))`, errno.ErrBadField}, // Refer generated columns non prior. - {`create table test_gv_ddl_bad (a int, b int as (c+1), c int as (a+1))`, mysql.ErrGeneratedColumnNonPrior}, + {`create table test_gv_ddl_bad (a int, b int as (c+1), c int as (a+1))`, errno.ErrGeneratedColumnNonPrior}, // Virtual generated columns cannot be primary key. - {`create table test_gv_ddl_bad (a int, b int, c int as (a+b) primary key)`, mysql.ErrUnsupportedOnGeneratedColumn}, - {`create table test_gv_ddl_bad (a int, b int, c int as (a+b), primary key(c))`, mysql.ErrUnsupportedOnGeneratedColumn}, - {`create table test_gv_ddl_bad (a int, b int, c int as (a+b), primary key(a, c))`, mysql.ErrUnsupportedOnGeneratedColumn}, + {`create table test_gv_ddl_bad (a int, b int, c int as (a+b) primary key)`, errno.ErrUnsupportedOnGeneratedColumn}, + {`create table test_gv_ddl_bad (a int, b int, c int as (a+b), primary key(c))`, errno.ErrUnsupportedOnGeneratedColumn}, + {`create table test_gv_ddl_bad (a int, b int, c int as (a+b), primary key(a, c))`, errno.ErrUnsupportedOnGeneratedColumn}, // Add stored generated column through alter table. - {`alter table test_gv_ddl add column d int as (b+2) stored`, mysql.ErrUnsupportedOnGeneratedColumn}, - {`alter table test_gv_ddl modify column b int as (a + 8) stored`, mysql.ErrUnsupportedOnGeneratedColumn}, + {`alter table test_gv_ddl add column d int as (b+2) stored`, errno.ErrUnsupportedOnGeneratedColumn}, + {`alter table test_gv_ddl modify column b int as (a + 8) stored`, errno.ErrUnsupportedOnGeneratedColumn}, } for _, tt := range genExprTests { s.tk.MustGetErrCode(tt.stmt, tt.err) @@ -2905,9 +2906,9 @@ func (s *testDBSuite4) TestComment(c *C) { s.tk.MustExec("create index i on ct (d) comment '" + validComment + "'") s.tk.MustExec("alter table ct add key (e) comment '" + validComment + "'") - s.tk.MustGetErrCode("create table ct1 (c int, key (c) comment '"+invalidComment+"')", mysql.ErrTooLongIndexComment) - s.tk.MustGetErrCode("create index i1 on ct (d) comment '"+invalidComment+"b"+"'", mysql.ErrTooLongIndexComment) - s.tk.MustGetErrCode("alter table ct add key (e) comment '"+invalidComment+"'", mysql.ErrTooLongIndexComment) + s.tk.MustGetErrCode("create table ct1 (c int, key (c) comment '"+invalidComment+"')", errno.ErrTooLongIndexComment) + s.tk.MustGetErrCode("create index i1 on ct (d) comment '"+invalidComment+"b"+"'", errno.ErrTooLongIndexComment) + s.tk.MustGetErrCode("alter table ct add key (e) comment '"+invalidComment+"'", errno.ErrTooLongIndexComment) s.tk.MustExec("set @@sql_mode=''") s.tk.MustExec("create table ct1 (c int, d int, e int, key (c) comment '" + invalidComment + "')") @@ -2952,23 +2953,23 @@ func (s *testSerialDBSuite) TestRebaseAutoID(c *C) { s.tk.MustQuery("select * from tidb.test").Check(testkit.Rows("1 1", "6000 1", "11000 1", "16000 1")) s.tk.MustExec("create table tidb.test2 (a int);") - s.tk.MustGetErrCode("alter table tidb.test2 add column b int auto_increment key, auto_increment=10;", mysql.ErrUnsupportedDDLOperation) + s.tk.MustGetErrCode("alter table tidb.test2 add column b int auto_increment key, auto_increment=10;", errno.ErrUnsupportedDDLOperation) } func (s *testDBSuite5) TestCheckColumnDefaultValue(c *C) { s.tk = testkit.NewTestKit(c, s.store) s.tk.MustExec("use test;") s.tk.MustExec("drop table if exists text_default_text;") - s.tk.MustGetErrCode("create table text_default_text(c1 text not null default '');", mysql.ErrBlobCantHaveDefault) - s.tk.MustGetErrCode("create table text_default_text(c1 text not null default 'scds');", mysql.ErrBlobCantHaveDefault) + s.tk.MustGetErrCode("create table text_default_text(c1 text not null default '');", errno.ErrBlobCantHaveDefault) + s.tk.MustGetErrCode("create table text_default_text(c1 text not null default 'scds');", errno.ErrBlobCantHaveDefault) s.tk.MustExec("drop table if exists text_default_json;") - s.tk.MustGetErrCode("create table text_default_json(c1 json not null default '');", mysql.ErrBlobCantHaveDefault) - s.tk.MustGetErrCode("create table text_default_json(c1 json not null default 'dfew555');", mysql.ErrBlobCantHaveDefault) + s.tk.MustGetErrCode("create table text_default_json(c1 json not null default '');", errno.ErrBlobCantHaveDefault) + s.tk.MustGetErrCode("create table text_default_json(c1 json not null default 'dfew555');", errno.ErrBlobCantHaveDefault) s.tk.MustExec("drop table if exists text_default_blob;") - s.tk.MustGetErrCode("create table text_default_blob(c1 blob not null default '');", mysql.ErrBlobCantHaveDefault) - s.tk.MustGetErrCode("create table text_default_blob(c1 blob not null default 'scds54');", mysql.ErrBlobCantHaveDefault) + s.tk.MustGetErrCode("create table text_default_blob(c1 blob not null default '');", errno.ErrBlobCantHaveDefault) + s.tk.MustGetErrCode("create table text_default_blob(c1 blob not null default 'scds54');", errno.ErrBlobCantHaveDefault) s.tk.MustExec("set sql_mode='';") s.tk.MustExec("create table text_default_text(c1 text not null default '');") @@ -3081,7 +3082,7 @@ func (s *testDBSuite3) TestColumnModifyingDefinition(c *C) { s.tk.MustExec("drop table if exists test2;") s.tk.MustExec("create table test2 (c1 int, c2 int, c3 int default 1, index (c1));") s.tk.MustExec("insert into test2(c2) values (null);") - s.tk.MustGetErrCode("alter table test2 change c2 a int not null", mysql.ErrInvalidUseOfNull) + s.tk.MustGetErrCode("alter table test2 change c2 a int not null", errno.ErrInvalidUseOfNull) s.tk.MustGetErrCode("alter table test2 change c1 a1 bigint not null;", mysql.WarnDataTruncated) } @@ -3099,11 +3100,11 @@ func (s *testDBSuite4) TestCheckTooBigFieldLength(c *C) { s.tk.MustExec("drop table if exists tr_04;") s.tk.MustExec("create table tr_04 (a varchar(20000) ) default charset utf8;") - s.tk.MustGetErrCode("alter table tr_04 add column b varchar(20000) charset utf8mb4;", mysql.ErrTooBigFieldlength) - s.tk.MustGetErrCode("alter table tr_04 convert to character set utf8mb4;", mysql.ErrTooBigFieldlength) - s.tk.MustGetErrCode("create table tr (id int, name varchar(30000), purchased date ) default charset=utf8 collate=utf8_bin;", mysql.ErrTooBigFieldlength) - s.tk.MustGetErrCode("create table tr (id int, name varchar(20000) charset utf8mb4, purchased date ) default charset=utf8 collate=utf8_bin;", mysql.ErrTooBigFieldlength) - s.tk.MustGetErrCode("create table tr (id int, name varchar(65536), purchased date ) default charset=latin1;", mysql.ErrTooBigFieldlength) + s.tk.MustGetErrCode("alter table tr_04 add column b varchar(20000) charset utf8mb4;", errno.ErrTooBigFieldlength) + s.tk.MustGetErrCode("alter table tr_04 convert to character set utf8mb4;", errno.ErrTooBigFieldlength) + s.tk.MustGetErrCode("create table tr (id int, name varchar(30000), purchased date ) default charset=utf8 collate=utf8_bin;", errno.ErrTooBigFieldlength) + s.tk.MustGetErrCode("create table tr (id int, name varchar(20000) charset utf8mb4, purchased date ) default charset=utf8 collate=utf8_bin;", errno.ErrTooBigFieldlength) + s.tk.MustGetErrCode("create table tr (id int, name varchar(65536), purchased date ) default charset=latin1;", errno.ErrTooBigFieldlength) s.tk.MustExec("drop table if exists tr_05;") s.tk.MustExec("create table tr_05 (a varchar(16000) charset utf8);") @@ -3121,9 +3122,9 @@ func (s *testDBSuite5) TestCheckConvertToCharacter(c *C) { is := domain.GetDomain(ctx).InfoSchema() t, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("t")) c.Assert(err, IsNil) - s.tk.MustGetErrCode("alter table t modify column a varchar(10) charset utf8 collate utf8_bin", mysql.ErrUnsupportedDDLOperation) - s.tk.MustGetErrCode("alter table t modify column a varchar(10) charset utf8mb4 collate utf8mb4_bin", mysql.ErrUnsupportedDDLOperation) - s.tk.MustGetErrCode("alter table t modify column a varchar(10) charset latin1 collate latin1_bin", mysql.ErrUnsupportedDDLOperation) + s.tk.MustGetErrCode("alter table t modify column a varchar(10) charset utf8 collate utf8_bin", errno.ErrUnsupportedDDLOperation) + s.tk.MustGetErrCode("alter table t modify column a varchar(10) charset utf8mb4 collate utf8mb4_bin", errno.ErrUnsupportedDDLOperation) + s.tk.MustGetErrCode("alter table t modify column a varchar(10) charset latin1 collate latin1_bin", errno.ErrUnsupportedDDLOperation) c.Assert(t.Cols()[0].Charset, Equals, "binary") } @@ -3148,7 +3149,7 @@ func (s *testDBSuite5) TestModifyColumnRollBack(c *C) { } } if mysql.HasPreventNullInsertFlag(c2.Flag) { - s.tk.MustGetErrCode("insert into t1(c2) values (null);", mysql.ErrBadNull) + s.tk.MustGetErrCode("insert into t1(c2) values (null);", errno.ErrBadNull) } hookCtx := mock.NewContext() @@ -3463,7 +3464,7 @@ func (s *testDBSuite4) TestIfNotExists(c *C) { // ADD COLUMN sql := "alter table t1 add column b int" s.mustExec(c, sql) - s.tk.MustGetErrCode(sql, mysql.ErrDupFieldName) + s.tk.MustGetErrCode(sql, errno.ErrDupFieldName) s.mustExec(c, "alter table t1 add column if not exists b int") c.Assert(s.tk.Se.GetSessionVars().StmtCtx.WarningCount(), Equals, uint16(1)) s.tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Note|1060|Duplicate column name 'b'")) @@ -3471,14 +3472,14 @@ func (s *testDBSuite4) TestIfNotExists(c *C) { // ADD INDEX sql = "alter table t1 add index idx_b (b)" s.mustExec(c, sql) - s.tk.MustGetErrCode(sql, mysql.ErrDupKeyName) + s.tk.MustGetErrCode(sql, errno.ErrDupKeyName) s.mustExec(c, "alter table t1 add index if not exists idx_b (b)") c.Assert(s.tk.Se.GetSessionVars().StmtCtx.WarningCount(), Equals, uint16(1)) s.tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Note|1061|index already exist idx_b")) // CREATE INDEX sql = "create index idx_b on t1 (b)" - s.tk.MustGetErrCode(sql, mysql.ErrDupKeyName) + s.tk.MustGetErrCode(sql, errno.ErrDupKeyName) s.mustExec(c, "create index if not exists idx_b on t1 (b)") c.Assert(s.tk.Se.GetSessionVars().StmtCtx.WarningCount(), Equals, uint16(1)) s.tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Note|1061|index already exist idx_b")) @@ -3488,7 +3489,7 @@ func (s *testDBSuite4) TestIfNotExists(c *C) { s.mustExec(c, "create table t2 (a int key) partition by range(a) (partition p0 values less than (10), partition p1 values less than (20))") sql = "alter table t2 add partition (partition p2 values less than (30))" s.mustExec(c, sql) - s.tk.MustGetErrCode(sql, mysql.ErrSameNamePartition) + s.tk.MustGetErrCode(sql, errno.ErrSameNamePartition) s.mustExec(c, "alter table t2 add partition if not exists (partition p2 values less than (30))") c.Assert(s.tk.Se.GetSessionVars().StmtCtx.WarningCount(), Equals, uint16(1)) s.tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Note|1517|Duplicate partition name p2")) @@ -3503,14 +3504,14 @@ func (s *testDBSuite4) TestIfExists(c *C) { // DROP COLUMN sql := "alter table t1 drop column b" s.mustExec(c, sql) - s.tk.MustGetErrCode(sql, mysql.ErrCantDropFieldOrKey) + s.tk.MustGetErrCode(sql, errno.ErrCantDropFieldOrKey) s.mustExec(c, "alter table t1 drop column if exists b") // only `a` exists now c.Assert(s.tk.Se.GetSessionVars().StmtCtx.WarningCount(), Equals, uint16(1)) s.tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Note|1091|column b doesn't exist")) // CHANGE COLUMN sql = "alter table t1 change column b c int" - s.tk.MustGetErrCode(sql, mysql.ErrBadField) + s.tk.MustGetErrCode(sql, errno.ErrBadField) s.mustExec(c, "alter table t1 change column if exists b c int") c.Assert(s.tk.Se.GetSessionVars().StmtCtx.WarningCount(), Equals, uint16(1)) s.tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Note|1054|Unknown column 'b' in 't1'")) @@ -3518,7 +3519,7 @@ func (s *testDBSuite4) TestIfExists(c *C) { // MODIFY COLUMN sql = "alter table t1 modify column a bigint" - s.tk.MustGetErrCode(sql, mysql.ErrBadField) + s.tk.MustGetErrCode(sql, errno.ErrBadField) s.mustExec(c, "alter table t1 modify column if exists a bigint") c.Assert(s.tk.Se.GetSessionVars().StmtCtx.WarningCount(), Equals, uint16(1)) s.tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Note|1054|Unknown column 'a' in 't1'")) @@ -3528,7 +3529,7 @@ func (s *testDBSuite4) TestIfExists(c *C) { s.mustExec(c, "alter table t1 add index idx_c (c)") sql = "alter table t1 drop index idx_c" s.mustExec(c, sql) - s.tk.MustGetErrCode(sql, mysql.ErrCantDropFieldOrKey) + s.tk.MustGetErrCode(sql, errno.ErrCantDropFieldOrKey) s.mustExec(c, "alter table t1 drop index if exists idx_c") c.Assert(s.tk.Se.GetSessionVars().StmtCtx.WarningCount(), Equals, uint16(1)) s.tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Note|1091|index idx_c doesn't exist")) @@ -3538,7 +3539,7 @@ func (s *testDBSuite4) TestIfExists(c *C) { s.mustExec(c, "create table t2 (a int key) partition by range(a) (partition p0 values less than (10), partition p1 values less than (20))") sql = "alter table t2 drop partition p1" s.mustExec(c, sql) - s.tk.MustGetErrCode(sql, mysql.ErrDropPartitionNonExistent) + s.tk.MustGetErrCode(sql, errno.ErrDropPartitionNonExistent) s.mustExec(c, "alter table t2 drop partition if exists p1") c.Assert(s.tk.Se.GetSessionVars().StmtCtx.WarningCount(), Equals, uint16(1)) s.tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Note|1507|Error in list of partitions to p1")) @@ -3711,7 +3712,7 @@ func (s *testDBSuite5) TestDefaultSQLFunction(c *C) { tk.MustExec("create table t4(a int default 4);") tk.MustExec("insert into t4 value (2);") tk.MustQuery("select default(c) from (select b as c from (select a as b from t4) t3) t2;").Check(testkit.Rows("4")) - tk.MustGetErrCode("select default(a) from (select a from (select 1 as a) t4) t4;", mysql.ErrNoDefaultForField) + tk.MustGetErrCode("select default(a) from (select a from (select 1 as a) t4) t4;", errno.ErrNoDefaultForField) tk.MustExec("drop table t1, t2, t3, t4;") } diff --git a/ddl/sequence_test.go b/ddl/sequence_test.go index 467e0c11740a0..dcf803806c964 100644 --- a/ddl/sequence_test.go +++ b/ddl/sequence_test.go @@ -19,9 +19,9 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/parser/auth" "github.com/pingcap/parser/model" - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/ddl" + mysql "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/table/tables" "github.com/pingcap/tidb/util/testkit" diff --git a/domain/domain_test.go b/domain/domain_test.go index a38a9b1b83278..5669809e15822 100644 --- a/domain/domain_test.go +++ b/domain/domain_test.go @@ -27,9 +27,9 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/parser/ast" "github.com/pingcap/parser/model" - "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/domain/infosync" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/metrics" @@ -453,6 +453,6 @@ func (*testSuite) TestSessionPool(c *C) { } func (*testSuite) TestErrorCode(c *C) { - c.Assert(int(ErrInfoSchemaExpired.ToSQLError().Code), Equals, mysql.ErrInfoSchemaExpired) - c.Assert(int(ErrInfoSchemaChanged.ToSQLError().Code), Equals, mysql.ErrInfoSchemaChanged) + c.Assert(int(ErrInfoSchemaExpired.ToSQLError().Code), Equals, errno.ErrInfoSchemaExpired) + c.Assert(int(ErrInfoSchemaChanged.ToSQLError().Code), Equals, errno.ErrInfoSchemaChanged) } diff --git a/executor/seqtest/seq_executor_test.go b/executor/seqtest/seq_executor_test.go index 86ea4923862b7..38cdd5d99a98c 100644 --- a/executor/seqtest/seq_executor_test.go +++ b/executor/seqtest/seq_executor_test.go @@ -43,6 +43,7 @@ import ( "github.com/pingcap/tidb/ddl" ddltestutil "github.com/pingcap/tidb/ddl/testutil" "github.com/pingcap/tidb/domain" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/executor" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" @@ -1213,7 +1214,7 @@ func (s *seqTestSuite) TestAutoRandIDRetry(c *C) { tk.MustExec("insert into t values ()") c.Assert(failpoint.Enable(fpName, `return(true)`), IsNil) // Insertion failure will skip the 6 in retryInfo. - tk.MustGetErrCode("commit", mysql.ErrTxnRetryable) + tk.MustGetErrCode("commit", errno.ErrTxnRetryable) c.Assert(failpoint.Disable(fpName), IsNil) tk.MustExec("insert into t values ()") diff --git a/server/server_test.go b/server/server_test.go index 9de487560bc52..cca091c0fe04e 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -36,6 +36,7 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/log" tmysql "github.com/pingcap/parser/mysql" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/util/logutil" "github.com/pingcap/tidb/util/printer" @@ -782,7 +783,7 @@ func (cli *testServerClient) runTestLoadData(c *C, server *Server) { dbt.mustExec("set @@tidb_dml_batch_size = 3") _, err = dbt.db.Exec("load data local infile '/tmp/load_data_test.csv' into table test") dbt.Assert(err, NotNil) - checkErrorCode(c, err, tmysql.ErrNotAllowedCommand) + checkErrorCode(c, err, errno.ErrNotAllowedCommand) }) server.capability |= tmysql.ClientLocalFiles @@ -881,50 +882,50 @@ func (cli *testServerClient) runTestErrorCode(c *C) { _, err = txn1.Exec("insert into test values(1)") c.Assert(err, IsNil) err = txn1.Commit() - checkErrorCode(c, err, tmysql.ErrDupEntry) + checkErrorCode(c, err, errno.ErrDupEntry) // Schema errors txn2, err := dbt.db.Begin() c.Assert(err, IsNil) _, err = txn2.Exec("use db_not_exists;") - checkErrorCode(c, err, tmysql.ErrBadDB) + checkErrorCode(c, err, errno.ErrBadDB) _, err = txn2.Exec("select * from tbl_not_exists;") - checkErrorCode(c, err, tmysql.ErrNoSuchTable) + checkErrorCode(c, err, errno.ErrNoSuchTable) _, err = txn2.Exec("create database test;") // Make tests stable. Some times the error may be the ErrInfoSchemaChanged. - checkErrorCode(c, err, tmysql.ErrDBCreateExists, tmysql.ErrInfoSchemaChanged) + checkErrorCode(c, err, errno.ErrDBCreateExists, errno.ErrInfoSchemaChanged) _, err = txn2.Exec("create database aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;") - checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrInfoSchemaChanged) + checkErrorCode(c, err, errno.ErrTooLongIdent, errno.ErrInfoSchemaChanged) _, err = txn2.Exec("create table test (c int);") - checkErrorCode(c, err, tmysql.ErrTableExists, tmysql.ErrInfoSchemaChanged) + checkErrorCode(c, err, errno.ErrTableExists, errno.ErrInfoSchemaChanged) _, err = txn2.Exec("drop table unknown_table;") - checkErrorCode(c, err, tmysql.ErrBadTable, tmysql.ErrInfoSchemaChanged) + checkErrorCode(c, err, errno.ErrBadTable, errno.ErrInfoSchemaChanged) _, err = txn2.Exec("drop database unknown_db;") - checkErrorCode(c, err, tmysql.ErrDBDropExists, tmysql.ErrInfoSchemaChanged) + checkErrorCode(c, err, errno.ErrDBDropExists, errno.ErrInfoSchemaChanged) _, err = txn2.Exec("create table aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (a int);") - checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrInfoSchemaChanged) + checkErrorCode(c, err, errno.ErrTooLongIdent, errno.ErrInfoSchemaChanged) _, err = txn2.Exec("create table long_column_table (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);") - checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrInfoSchemaChanged) + checkErrorCode(c, err, errno.ErrTooLongIdent, errno.ErrInfoSchemaChanged) _, err = txn2.Exec("alter table test add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int;") - checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrInfoSchemaChanged) + checkErrorCode(c, err, errno.ErrTooLongIdent, errno.ErrInfoSchemaChanged) // Optimizer errors _, err = txn2.Exec("select *, * from test;") - checkErrorCode(c, err, tmysql.ErrInvalidWildCard) + checkErrorCode(c, err, errno.ErrInvalidWildCard) _, err = txn2.Exec("select row(1, 2) > 1;") - checkErrorCode(c, err, tmysql.ErrOperandColumns) + checkErrorCode(c, err, errno.ErrOperandColumns) _, err = txn2.Exec("select * from test order by row(c, c);") - checkErrorCode(c, err, tmysql.ErrOperandColumns) + checkErrorCode(c, err, errno.ErrOperandColumns) // Variable errors _, err = txn2.Exec("select @@unknown_sys_var;") - checkErrorCode(c, err, tmysql.ErrUnknownSystemVariable) + checkErrorCode(c, err, errno.ErrUnknownSystemVariable) _, err = txn2.Exec("set @@unknown_sys_var='1';") - checkErrorCode(c, err, tmysql.ErrUnknownSystemVariable) + checkErrorCode(c, err, errno.ErrUnknownSystemVariable) // Expression errors _, err = txn2.Exec("select greatest(2);") - checkErrorCode(c, err, tmysql.ErrWrongParamcountToNativeFct) + checkErrorCode(c, err, errno.ErrWrongParamcountToNativeFct) }) } diff --git a/table/table_test.go b/table/table_test.go index 3faae1ded2752..d3d0e5edd172c 100644 --- a/table/table_test.go +++ b/table/table_test.go @@ -15,7 +15,7 @@ package table import ( . "github.com/pingcap/check" - "github.com/pingcap/parser/mysql" + mysql "github.com/pingcap/tidb/errno" ) var _ = Suite(&testTableSuite{}) diff --git a/util/memory/tracker_test.go b/util/memory/tracker_test.go index f683cb37ad9df..90af6f679e4b1 100644 --- a/util/memory/tracker_test.go +++ b/util/memory/tracker_test.go @@ -21,7 +21,7 @@ import ( "github.com/cznic/mathutil" . "github.com/pingcap/check" - "github.com/pingcap/parser/mysql" + "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/util/logutil" "github.com/pingcap/tidb/util/stringutil" "github.com/pingcap/tidb/util/testleak" @@ -274,5 +274,5 @@ func BenchmarkConsume(b *testing.B) { } func (s *testSuite) TestErrorCode(c *C) { - c.Assert(int(errMemExceedThreshold.ToSQLError().Code), Equals, mysql.ErrMemExceedThreshold) + c.Assert(int(errMemExceedThreshold.ToSQLError().Code), Equals, errno.ErrMemExceedThreshold) } From 8d310b31f7e974810f2dde19a36529319ce6ba13 Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Wed, 11 Mar 2020 12:17:36 +0800 Subject: [PATCH 3/6] make golint happy --- errno/errcode.go | 8 ++++---- errno/errname.go | 8 ++++---- go.mod | 2 -- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/errno/errcode.go b/errno/errcode.go index b3bfd9f2fd61f..0d467df975434 100644 --- a/errno/errcode.go +++ b/errno/errcode.go @@ -926,11 +926,11 @@ const ( ErrWindowNestedWindowFuncUseInWindowSpec = 3595 ErrWindowRowsIntervalUse = 3596 ErrWindowNoGroupOrderUnused = 3597 - ErrWindowExplainJson = 3598 + ErrWindowExplainJSON = 3598 ErrWindowFunctionIgnoresFrame = 3599 ErrDataTruncatedFunctionalIndex = 3751 ErrDataOutOfRangeFunctionalIndex = 3752 - ErrFunctionalIndexOnJsonOrGeometryFunction = 3753 + ErrFunctionalIndexOnJSONOrGeometryFunction = 3753 ErrFunctionalIndexRefAutoIncrement = 3754 ErrCannotDropColumnFunctionalIndex = 3755 ErrFunctionalIndexPrimaryKey = 3756 @@ -943,8 +943,8 @@ const ( ErrFKIncompatibleColumns = 3780 ErrFunctionalIndexRowValueIsNotAllowed = 3800 ErrDependentByFunctionalIndex = 3837 - ErrInvalidJsonValueForFuncIndex = 3903 - ErrJsonValueOutOfRangeForFuncIndex = 3904 + ErrInvalidJSONValueForFuncIndex = 3903 + ErrJSONValueOutOfRangeForFuncIndex = 3904 ErrFunctionalIndexDataIsTooLong = 3907 ErrFunctionalIndexNotApplicable = 3909 diff --git a/errno/errname.go b/errno/errname.go index b16121166ecd1..509319287af2c 100644 --- a/errno/errname.go +++ b/errno/errname.go @@ -920,14 +920,14 @@ var MySQLErrName = map[uint16]string{ ErrWindowNestedWindowFuncUseInWindowSpec: "You cannot nest a window function in the specification of window '%s'.", ErrWindowRowsIntervalUse: "Window '%s': INTERVAL can only be used with RANGE frames.", ErrWindowNoGroupOrderUnused: "ASC or DESC with GROUP BY isn't allowed with window functions; put ASC or DESC in ORDER BY", - ErrWindowExplainJson: "To get information about window functions use EXPLAIN FORMAT=JSON", + ErrWindowExplainJSON: "To get information about window functions use EXPLAIN FORMAT=JSON", ErrWindowFunctionIgnoresFrame: "Window function '%s' ignores the frame clause of window '%s' and aggregates over the whole partition", ErrRoleNotGranted: "%s is is not granted to %s", ErrMaxExecTimeExceeded: "Query execution was interrupted, max_execution_time exceeded.", ErrLockAcquireFailAndNoWaitSet: "Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set.", ErrDataTruncatedFunctionalIndex: "Data truncated for functional index '%s' at row %d", ErrDataOutOfRangeFunctionalIndex: "Value is out of range for functional index '%s' at row %d", - ErrFunctionalIndexOnJsonOrGeometryFunction: "Cannot create a functional index on a function that returns a JSON or GEOMETRY value", + ErrFunctionalIndexOnJSONOrGeometryFunction: "Cannot create a functional index on a function that returns a JSON or GEOMETRY value", ErrFunctionalIndexRefAutoIncrement: "Functional index '%s' cannot refer to an auto-increment column", ErrCannotDropColumnFunctionalIndex: "Cannot drop column '%s' because it is used by a functional index. In order to drop the column, you must remove the functional index", ErrFunctionalIndexPrimaryKey: "The primary key cannot be a functional index", @@ -940,8 +940,8 @@ var MySQLErrName = map[uint16]string{ ErrFKIncompatibleColumns: "Referencing column '%s' in foreign key constraint '%s' are incompatible", ErrFunctionalIndexRowValueIsNotAllowed: "Expression of functional index '%s' cannot refer to a row value", ErrDependentByFunctionalIndex: "Column '%s' has a functional index dependency and cannot be dropped or renamed", - ErrInvalidJsonValueForFuncIndex: "Invalid JSON value for CAST for functional index '%s'", - ErrJsonValueOutOfRangeForFuncIndex: "Out of range JSON value for CAST for functional index '%s'", + ErrInvalidJSONValueForFuncIndex: "Invalid JSON value for CAST for functional index '%s'", + ErrJSONValueOutOfRangeForFuncIndex: "Out of range JSON value for CAST for functional index '%s'", ErrFunctionalIndexDataIsTooLong: "Data too long for functional index '%s'", ErrFunctionalIndexNotApplicable: "Cannot use functional index '%s' due to type or collation conversion", diff --git a/go.mod b/go.mod index d1a22de309847..3b4a75d6b0871 100644 --- a/go.mod +++ b/go.mod @@ -76,5 +76,3 @@ require ( ) go 1.13 - -replace github.com/pingcap/parser => github.com/tiancaiamao/parser v0.0.0-20200311030529-dfb7d5052a8b From cecd1c4c6ed89b21b001b2519ec5a78238d81e11 Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Wed, 11 Mar 2020 14:30:33 +0800 Subject: [PATCH 4/6] fix ci --- session/tidb.go | 1 + 1 file changed, 1 insertion(+) diff --git a/session/tidb.go b/session/tidb.go index c6572dc7e21ed..27a0db526c018 100644 --- a/session/tidb.go +++ b/session/tidb.go @@ -237,6 +237,7 @@ func checkStmtLimit(ctx context.Context, sctx sessionctx.Context, se *session) e // The last history could not be "commit"/"rollback" statement. // It means it is impossible to start a new transaction at the end of the transaction. // Because after the server executed "commit"/"rollback" statement, the session is out of the transaction. + sessVars.SetStatusFlag(mysql.ServerStatusInTrans, true) } return err } From 70562cb567360ad2ea469be138aeba2bf34d3eb8 Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Wed, 11 Mar 2020 14:49:32 +0800 Subject: [PATCH 5/6] fix typo --- ddl/db_integration_test.go | 6 +++--- errno/errcode.go | 2 +- errno/errname.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ddl/db_integration_test.go b/ddl/db_integration_test.go index 1faea03e9c4a9..221b064b2c052 100644 --- a/ddl/db_integration_test.go +++ b/ddl/db_integration_test.go @@ -1875,8 +1875,8 @@ func (s *testIntegrationSuite3) TestSqlFunctionsInGeneratedColumns(c *C) { tk.MustExec("drop table if exists t, t1") // In generated columns expression, these items are not allowed: - // 1. Blocked function (for full function list, please visit https://github.com/errno/errno-server/blob/5.7/errno-test/suite/gcol/inc/gcol_blocked_sql_funcs_main.inc) - // Note: This list is not complete, if you need a complete list, please refer to Errno 5.7 source code. + // 1. Blocked function (for full function list, please visit https://github.com/mysql/mysql-server/blob/5.7/errno-test/suite/gcol/inc/gcol_blocked_sql_funcs_main.inc) + // Note: This list is not complete, if you need a complete list, please refer to MySQL 5.7 source code. tk.MustGetErrCode("create table t (a int, b int as (sysdate()))", errno.ErrGeneratedColumnFunctionIsNotAllowed) // 2. Non-builtin function tk.MustGetErrCode("create table t (a int, b int as (non_exist_funcA()))", errno.ErrGeneratedColumnFunctionIsNotAllowed) @@ -1899,7 +1899,7 @@ func (s *testIntegrationSuite3) TestSqlFunctionsInGeneratedColumns(c *C) { tk.MustExec("insert into t1 values (-1, default)") tk.MustQuery("select * from t1").Check(testkit.Rows("-1 1")) - // Functions added in Errno 8.0, but now not supported in TiDB + // Functions added in MySQL 8.0, but now not supported in TiDB // They will be deal with non-exists function, and throw error.git tk.MustGetErrCode("create table t (a int, b int as (updatexml(1, 1, 1)))", errno.ErrGeneratedColumnFunctionIsNotAllowed) tk.MustGetErrCode("create table t (a int, b int as (statement_digest(1)))", errno.ErrGeneratedColumnFunctionIsNotAllowed) diff --git a/errno/errcode.go b/errno/errcode.go index 0d467df975434..fad12a6c72b09 100644 --- a/errno/errcode.go +++ b/errno/errcode.go @@ -1,4 +1,4 @@ -// Copyright 2015 PingCAP, Inc. +// Copyright 2020 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/errno/errname.go b/errno/errname.go index 509319287af2c..04677a9a3db20 100644 --- a/errno/errname.go +++ b/errno/errname.go @@ -1,4 +1,4 @@ -// Copyright 2015 PingCAP, Inc. +// Copyright 2020 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 86308c354d44b8856cd3d9da228cf5d6f0578560 Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Wed, 11 Mar 2020 15:16:23 +0800 Subject: [PATCH 6/6] go mod tidy --- go.sum | 6 ------ 1 file changed, 6 deletions(-) diff --git a/go.sum b/go.sum index ecc6fd5109a8b..ce1488dfee690 100644 --- a/go.sum +++ b/go.sum @@ -344,12 +344,6 @@ github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d h1:4J9HCZVpvDmj2t github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 h1:mbAskLJ0oJfDRtkanvQPiooDH8HvJ2FBh+iKT/OmiQQ= github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU= -github.com/tiancaiamao/parser v0.0.0-20200311024545-ff0568b33c35 h1:YXdyzP76zzpthmrHX+Ly8YB6pvn55leSvWEWYbimVik= -github.com/tiancaiamao/parser v0.0.0-20200311024545-ff0568b33c35/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= -github.com/tiancaiamao/parser v0.0.0-20200311025843-81dd2ffe3349 h1:UJlvOybNbqWgHY+BotmRXi4ilzBRH6GfPlKZpP3EDKc= -github.com/tiancaiamao/parser v0.0.0-20200311025843-81dd2ffe3349/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= -github.com/tiancaiamao/parser v0.0.0-20200311030529-dfb7d5052a8b h1:F4OXYBudCSmF/KN83UBUdRuzOqrI2ts0AVQtvMbHS34= -github.com/tiancaiamao/parser v0.0.0-20200311030529-dfb7d5052a8b/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= github.com/tidwall/gjson v1.3.5/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=