state.go 12 KB

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