This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new b20da098b9d Correct SQL state and error message for MySQL duplicate 
entry errors (#35421)
b20da098b9d is described below

commit b20da098b9ded53477056661427317462d9b3888
Author: Liang Zhang <zhangli...@apache.org>
AuthorDate: Thu May 15 13:32:56 2025 +0800

    Correct SQL state and error message for MySQL duplicate entry errors 
(#35421)
    
    - Update SQL state for ER_DUP_ENTRY from INTEGRITY_CONSTRAINT_VIOLATION to 
SYNTAX_ERROR
    - Update SQL state for ER_PARSE_ERROR from INTEGRITY_CONSTRAINT_VIOLATION 
to SYNTAX_ERROR
    - Correct error message format for ER_DUP_ENTRY
    - Correct error message format for ER_PARSE_ERROR
---
 .../shardingsphere/infra/exception/mysql/vendor/MySQLVendorError.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/infra/exception/dialect/type/mysql/src/main/java/org/apache/shardingsphere/infra/exception/mysql/vendor/MySQLVendorError.java
 
b/infra/exception/dialect/type/mysql/src/main/java/org/apache/shardingsphere/infra/exception/mysql/vendor/MySQLVendorError.java
index e8be69694ee..177ac7da77b 100644
--- 
a/infra/exception/dialect/type/mysql/src/main/java/org/apache/shardingsphere/infra/exception/mysql/vendor/MySQLVendorError.java
+++ 
b/infra/exception/dialect/type/mysql/src/main/java/org/apache/shardingsphere/infra/exception/mysql/vendor/MySQLVendorError.java
@@ -50,9 +50,9 @@ public enum MySQLVendorError implements VendorError {
     
     ER_TABLE_EXISTS_ERROR(XOpenSQLState.DUPLICATE, 1050, "Table '%s' already 
exists"),
     
-    ER_DUP_ENTRY(XOpenSQLState.SYNTAX_ERROR, 1062, "%s near '%s' at line %d"),
+    ER_DUP_ENTRY(XOpenSQLState.INTEGRITY_CONSTRAINT_VIOLATION, 1062, 
"Duplicate entry '%s' for key %d"),
     
-    ER_PARSE_ERROR(XOpenSQLState.INTEGRITY_CONSTRAINT_VIOLATION, 1064, 
"Duplicate entry '%s' for key %d"),
+    ER_PARSE_ERROR(XOpenSQLState.SYNTAX_ERROR, 1064, "%s near '%s' at line 
%d"),
     
     ER_UNKNOWN_CHARACTER_SET(XOpenSQLState.SYNTAX_ERROR, 1115, "Unknown 
character set: '%s'"),
     

Reply via email to