github.com/XiaoMi/Gaea@v1.2.5/mysql/error_state.go (about)

     1  // Copyright 2015 PingCAP, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  package mysql
    15  
    16  const (
    17  	// DefaultMySQLState is default state of the mySQL
    18  	DefaultMySQLState = "HY000"
    19  )
    20  
    21  // MySQLState maps error code to MySQL SQLSTATE value.
    22  // The values are taken from ANSI SQL and ODBC and are more standardized.
    23  var MySQLState = map[uint16]string{
    24  	ErrDupKey:                              "23000",
    25  	ErrOutofMemory:                         "HY001",
    26  	ErrOutOfSortMemory:                     "HY001",
    27  	ErrConCount:                            "08004",
    28  	ErrBadHost:                             "08S01",
    29  	ErrHandshake:                           "08S01",
    30  	ErrDBaccessDenied:                      "42000",
    31  	ErrAccessDenied:                        "28000",
    32  	ErrNoDB:                                "3D000",
    33  	ErrUnknownCom:                          "08S01",
    34  	ErrBadNull:                             "23000",
    35  	ErrBadDB:                               "42000",
    36  	ErrTableExists:                         "42S01",
    37  	ErrBadTable:                            "42S02",
    38  	ErrNonUniq:                             "23000",
    39  	ErrServerShutdown:                      "08S01",
    40  	ErrBadField:                            "42S22",
    41  	ErrFieldNotInGroupBy:                   "42000",
    42  	ErrWrongSumSelect:                      "42000",
    43  	ErrWrongGroupField:                     "42000",
    44  	ErrWrongValueCount:                     "21S01",
    45  	ErrTooLongIdent:                        "42000",
    46  	ErrDupFieldName:                        "42S21",
    47  	ErrDupKeyName:                          "42000",
    48  	ErrDupEntry:                            "23000",
    49  	ErrWrongFieldSpec:                      "42000",
    50  	ErrParse:                               "42000",
    51  	ErrEmptyQuery:                          "42000",
    52  	ErrNonuniqTable:                        "42000",
    53  	ErrInvalidDefault:                      "42000",
    54  	ErrMultiplePriKey:                      "42000",
    55  	ErrTooManyKeys:                         "42000",
    56  	ErrTooManyKeyParts:                     "42000",
    57  	ErrTooLongKey:                          "42000",
    58  	ErrKeyColumnDoesNotExits:               "42000",
    59  	ErrBlobUsedAsKey:                       "42000",
    60  	ErrTooBigFieldlength:                   "42000",
    61  	ErrWrongAutoKey:                        "42000",
    62  	ErrForcingClose:                        "08S01",
    63  	ErrIpsock:                              "08S01",
    64  	ErrNoSuchIndex:                         "42S12",
    65  	ErrWrongFieldTerminators:               "42000",
    66  	ErrBlobsAndNoTerminated:                "42000",
    67  	ErrCantRemoveAllFields:                 "42000",
    68  	ErrCantDropFieldOrKey:                  "42000",
    69  	ErrBlobCantHaveDefault:                 "42000",
    70  	ErrWrongDBName:                         "42000",
    71  	ErrWrongTableName:                      "42000",
    72  	ErrTooBigSelect:                        "42000",
    73  	ErrUnknownProcedure:                    "42000",
    74  	ErrWrongParamcountToProcedure:          "42000",
    75  	ErrUnknownTable:                        "42S02",
    76  	ErrFieldSpecifiedTwice:                 "42000",
    77  	ErrUnsupportedExtension:                "42000",
    78  	ErrTableMustHaveColumns:                "42000",
    79  	ErrUnknownCharacterSet:                 "42000",
    80  	ErrTooBigRowsize:                       "42000",
    81  	ErrWrongOuterJoin:                      "42000",
    82  	ErrNullColumnInIndex:                   "42000",
    83  	ErrPasswordAnonymousUser:               "42000",
    84  	ErrPasswordNotAllowed:                  "42000",
    85  	ErrPasswordNoMatch:                     "42000",
    86  	ErrWrongValueCountOnRow:                "21S01",
    87  	ErrInvalidUseOfNull:                    "22004",
    88  	ErrRegexp:                              "42000",
    89  	ErrMixOfGroupFuncAndFields:             "42000",
    90  	ErrNonexistingGrant:                    "42000",
    91  	ErrTableaccessDenied:                   "42000",
    92  	ErrColumnaccessDenied:                  "42000",
    93  	ErrIllegalGrantForTable:                "42000",
    94  	ErrGrantWrongHostOrUser:                "42000",
    95  	ErrNoSuchTable:                         "42S02",
    96  	ErrNonexistingTableGrant:               "42000",
    97  	ErrNotAllowedCommand:                   "42000",
    98  	ErrSyntax:                              "42000",
    99  	ErrAbortingConnection:                  "08S01",
   100  	ErrNetPacketTooLarge:                   "08S01",
   101  	ErrNetReadErrorFromPipe:                "08S01",
   102  	ErrNetFcntl:                            "08S01",
   103  	ErrNetPacketsOutOfOrder:                "08S01",
   104  	ErrNetUncompress:                       "08S01",
   105  	ErrNetRead:                             "08S01",
   106  	ErrNetReadInterrupted:                  "08S01",
   107  	ErrNetErrorOnWrite:                     "08S01",
   108  	ErrNetWriteInterrupted:                 "08S01",
   109  	ErrTooLongString:                       "42000",
   110  	ErrTableCantHandleBlob:                 "42000",
   111  	ErrTableCantHandleAutoIncrement:        "42000",
   112  	ErrWrongColumnName:                     "42000",
   113  	ErrWrongKeyColumn:                      "42000",
   114  	ErrDupUnique:                           "23000",
   115  	ErrBlobKeyWithoutLength:                "42000",
   116  	ErrPrimaryCantHaveNull:                 "42000",
   117  	ErrTooManyRows:                         "42000",
   118  	ErrRequiresPrimaryKey:                  "42000",
   119  	ErrKeyDoesNotExist:                     "42000",
   120  	ErrCheckNoSuchTable:                    "42000",
   121  	ErrCheckNotImplemented:                 "42000",
   122  	ErrCantDoThisDuringAnTransaction:       "25000",
   123  	ErrNewAbortingConnection:               "08S01",
   124  	ErrMasterNetRead:                       "08S01",
   125  	ErrMasterNetWrite:                      "08S01",
   126  	ErrTooManyUserConnections:              "42000",
   127  	ErrReadOnlyTransaction:                 "25000",
   128  	ErrNoPermissionToCreateUser:            "42000",
   129  	ErrLockDeadlock:                        "40001",
   130  	ErrNoReferencedRow:                     "23000",
   131  	ErrRowIsReferenced:                     "23000",
   132  	ErrConnectToMaster:                     "08S01",
   133  	ErrWrongNumberOfColumnsInSelect:        "21000",
   134  	ErrUserLimitReached:                    "42000",
   135  	ErrSpecificAccessDenied:                "42000",
   136  	ErrNoDefault:                           "42000",
   137  	ErrWrongValueForVar:                    "42000",
   138  	ErrWrongTypeForVar:                     "42000",
   139  	ErrCantUseOptionHere:                   "42000",
   140  	ErrNotSupportedYet:                     "42000",
   141  	ErrWrongFkDef:                          "42000",
   142  	ErrOperandColumns:                      "21000",
   143  	ErrSubqueryNo1Row:                      "21000",
   144  	ErrIllegalReference:                    "42S22",
   145  	ErrDerivedMustHaveAlias:                "42000",
   146  	ErrSelectReduced:                       "01000",
   147  	ErrTablenameNotAllowedHere:             "42000",
   148  	ErrNotSupportedAuthMode:                "08004",
   149  	ErrSpatialCantHaveNull:                 "42000",
   150  	ErrCollationCharsetMismatch:            "42000",
   151  	ErrWarnTooFewRecords:                   "01000",
   152  	ErrWarnTooManyRecords:                  "01000",
   153  	ErrWarnNullToNotnull:                   "22004",
   154  	ErrWarnDataOutOfRange:                  "22003",
   155  	WarnDataTruncated:                      "01000",
   156  	ErrWrongNameForIndex:                   "42000",
   157  	ErrWrongNameForCatalog:                 "42000",
   158  	ErrUnknownStorageEngine:                "42000",
   159  	ErrTruncatedWrongValue:                 "22007",
   160  	ErrSpNoRecursiveCreate:                 "2F003",
   161  	ErrSpAlreadyExists:                     "42000",
   162  	ErrSpDoesNotExist:                      "42000",
   163  	ErrSpLilabelMismatch:                   "42000",
   164  	ErrSpLabelRedefine:                     "42000",
   165  	ErrSpLabelMismatch:                     "42000",
   166  	ErrSpUninitVar:                         "01000",
   167  	ErrSpBadselect:                         "0A000",
   168  	ErrSpBadreturn:                         "42000",
   169  	ErrSpBadstatement:                      "0A000",
   170  	ErrUpdateLogDeprecatedIgnored:          "42000",
   171  	ErrUpdateLogDeprecatedTranslated:       "42000",
   172  	ErrQueryInterrupted:                    "70100",
   173  	ErrSpWrongNoOfArgs:                     "42000",
   174  	ErrSpCondMismatch:                      "42000",
   175  	ErrSpNoreturn:                          "42000",
   176  	ErrSpNoreturnend:                       "2F005",
   177  	ErrSpBadCursorQuery:                    "42000",
   178  	ErrSpBadCursorSelect:                   "42000",
   179  	ErrSpCursorMismatch:                    "42000",
   180  	ErrSpCursorAlreadyOpen:                 "24000",
   181  	ErrSpCursorNotOpen:                     "24000",
   182  	ErrSpUndeclaredVar:                     "42000",
   183  	ErrSpFetchNoData:                       "02000",
   184  	ErrSpDupParam:                          "42000",
   185  	ErrSpDupVar:                            "42000",
   186  	ErrSpDupCond:                           "42000",
   187  	ErrSpDupCurs:                           "42000",
   188  	ErrSpSubselectNyi:                      "0A000",
   189  	ErrStmtNotAllowedInSfOrTrg:             "0A000",
   190  	ErrSpVarcondAfterCurshndlr:             "42000",
   191  	ErrSpCursorAfterHandler:                "42000",
   192  	ErrSpCaseNotFound:                      "20000",
   193  	ErrDivisionByZero:                      "22012",
   194  	ErrIllegalValueForType:                 "22007",
   195  	ErrProcaccessDenied:                    "42000",
   196  	ErrXaerNota:                            "XAE04",
   197  	ErrXaerInval:                           "XAE05",
   198  	ErrXaerRmfail:                          "XAE07",
   199  	ErrXaerOutside:                         "XAE09",
   200  	ErrXaerRmerr:                           "XAE03",
   201  	ErrXaRbrollback:                        "XA100",
   202  	ErrNonexistingProcGrant:                "42000",
   203  	ErrDataTooLong:                         "22001",
   204  	ErrSpBadSQLstate:                       "42000",
   205  	ErrCantCreateUserWithGrant:             "42000",
   206  	ErrSpDupHandler:                        "42000",
   207  	ErrSpNotVarArg:                         "42000",
   208  	ErrSpNoRetset:                          "0A000",
   209  	ErrCantCreateGeometryObject:            "22003",
   210  	ErrTooBigScale:                         "42000",
   211  	ErrTooBigPrecision:                     "42000",
   212  	ErrMBiggerThanD:                        "42000",
   213  	ErrTooLongBody:                         "42000",
   214  	ErrTooBigDisplaywidth:                  "42000",
   215  	ErrXaerDupid:                           "XAE08",
   216  	ErrDatetimeFunctionOverflow:            "22008",
   217  	ErrRowIsReferenced2:                    "23000",
   218  	ErrNoReferencedRow2:                    "23000",
   219  	ErrSpBadVarShadow:                      "42000",
   220  	ErrSpWrongName:                         "42000",
   221  	ErrSpNoAggregate:                       "42000",
   222  	ErrMaxPreparedStmtCountReached:         "42000",
   223  	ErrNonGroupingFieldUsed:                "42000",
   224  	ErrForeignDuplicateKeyOldUnused:        "23000",
   225  	ErrCantChangeTxCharacteristics:         "25001",
   226  	ErrWrongParamcountToNativeFct:          "42000",
   227  	ErrWrongParametersToNativeFct:          "42000",
   228  	ErrWrongParametersToStoredFct:          "42000",
   229  	ErrDupEntryWithKeyName:                 "23000",
   230  	ErrXaRbtimeout:                         "XA106",
   231  	ErrXaRbdeadlock:                        "XA102",
   232  	ErrFuncInexistentNameCollision:         "42000",
   233  	ErrDupSignalSet:                        "42000",
   234  	ErrSignalWarn:                          "01000",
   235  	ErrSignalNotFound:                      "02000",
   236  	ErrSignalException:                     "HY000",
   237  	ErrResignalWithoutActiveHandler:        "0K000",
   238  	ErrSpatialMustHaveGeomCol:              "42000",
   239  	ErrDataOutOfRange:                      "22003",
   240  	ErrAccessDeniedNoPassword:              "28000",
   241  	ErrTruncateIllegalFk:                   "42000",
   242  	ErrDaInvalidConditionNumber:            "35000",
   243  	ErrForeignDuplicateKeyWithChildInfo:    "23000",
   244  	ErrForeignDuplicateKeyWithoutChildInfo: "23000",
   245  	ErrCantExecuteInReadOnlyTransaction:    "25006",
   246  	ErrAlterOperationNotSupported:          "0A000",
   247  	ErrAlterOperationNotSupportedReason:    "0A000",
   248  	ErrDupUnknownInIndex:                   "23000",
   249  	ErrBadGeneratedColumn:                  "HY000",
   250  	ErrUnsupportedOnGeneratedColumn:        "HY000",
   251  	ErrGeneratedColumnNonPrior:             "HY000",
   252  	ErrDependentByGeneratedColumn:          "HY000",
   253  	ErrInvalidJSONText:                     "22032",
   254  	ErrInvalidJSONPath:                     "42000",
   255  	ErrInvalidJSONData:                     "22032",
   256  	ErrInvalidJSONPathWildcard:             "42000",
   257  	ErrJSONUsedAsKey:                       "42000",
   258  }