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

sunnianjun 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 b76029b8f5e Revise #33885 (#33903)
b76029b8f5e is described below

commit b76029b8f5e58f7fb9c21aab90fc5d881f029e36
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Dec 3 21:01:39 2024 +0800

    Revise #33885 (#33903)
---
 .../postgresql/mapper/PostgreSQLDialectExceptionMapper.java   |  3 +--
 .../infra/exception/postgresql/sqlstate/PostgreSQLState.java  | 11 ++++++++++-
 .../exception/postgresql/vendor/PostgreSQLVendorError.java    |  5 ++++-
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git 
a/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/mapper/PostgreSQLDialectExceptionMapper.java
 
b/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/mapper/PostgreSQLDialectExceptionMapper.java
index a4287db32b8..41cf52d1b7c 100644
--- 
a/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/mapper/PostgreSQLDialectExceptionMapper.java
+++ 
b/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/mapper/PostgreSQLDialectExceptionMapper.java
@@ -58,8 +58,7 @@ public final class PostgreSQLDialectExceptionMapper 
implements SQLDialectExcepti
             return new PostgreSQLException(new 
ServerErrorMessage(FATAL_SEVERITY, PostgreSQLVendorError.DUPLICATE_DATABASE, 
((DatabaseCreateExistsException) sqlDialectException).getDatabaseName()));
         }
         if (sqlDialectException instanceof NoSuchTableException) {
-            NoSuchTableException cause = (NoSuchTableException) 
sqlDialectException;
-            return new PostgreSQLException(new 
ServerErrorMessage(FATAL_SEVERITY, PostgreSQLVendorError.NO_SUCH_TABLE, 
cause.getTableName()));
+            return new PostgreSQLException(new 
ServerErrorMessage(FATAL_SEVERITY, PostgreSQLVendorError.NO_SUCH_TABLE, 
((NoSuchTableException) sqlDialectException).getTableName()));
         }
         if (sqlDialectException instanceof TableExistsException) {
             return new PostgreSQLException(new 
ServerErrorMessage(ERROR_SEVERITY, PostgreSQLVendorError.DUPLICATE_TABLE, 
((TableExistsException) sqlDialectException).getTableName()));
diff --git 
a/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/sqlstate/PostgreSQLState.java
 
b/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/sqlstate/PostgreSQLState.java
index 1f561817df0..3cf5097e08b 100644
--- 
a/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/sqlstate/PostgreSQLState.java
+++ 
b/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/sqlstate/PostgreSQLState.java
@@ -29,13 +29,22 @@ import 
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.SQLS
 public enum PostgreSQLState implements SQLState {
     
     PROTOCOL_VIOLATION("08P01"),
+    
     SYNTAX_ERROR("42601"),
+    
     DUPLICATE_DATABASE("42P04"),
+    
     DUPLICATE_TABLE("42P07"),
+    
     INVALID_PASSWORD("28P01"),
-    UNDEFINED_COLUMN("42703"),
+    
     UNDEFINED_TABLE("42P01"),
+    
+    UNDEFINED_COLUMN("42703"),
+    
     SYSTEM_ERROR("58000"),
+    
     UNEXPECTED_ERROR("99999");
+    
     private final String value;
 }
diff --git 
a/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/vendor/PostgreSQLVendorError.java
 
b/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/vendor/PostgreSQLVendorError.java
index 002bc453e31..7f8488eb0ed 100644
--- 
a/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/vendor/PostgreSQLVendorError.java
+++ 
b/infra/exception/dialect/type/postgresql/src/main/java/org/apache/shardingsphere/infra/exception/postgresql/vendor/PostgreSQLVendorError.java
@@ -48,10 +48,13 @@ public enum PostgreSQLVendorError implements VendorError {
     
INVALID_AUTHORIZATION_SPECIFICATION(XOpenSQLState.INVALID_AUTHORIZATION_SPECIFICATION,
 "unknown username: %s"),
     
     NO_USERNAME(XOpenSQLState.INVALID_AUTHORIZATION_SPECIFICATION, "no 
PostgreSQL user name specified in startup packet"),
-    NO_SUCH_TABLE(PostgreSQLState.UNDEFINED_TABLE, "Table '%s' doesn't exist"),
+    
     INVALID_PASSWORD(PostgreSQLState.INVALID_PASSWORD, "password 
authentication failed for user \"%s\""),
+    
     INVALID_CATALOG_NAME(XOpenSQLState.INVALID_CATALOG_NAME, "database \"%s\" 
does not exist"),
     
+    NO_SUCH_TABLE(PostgreSQLState.UNDEFINED_TABLE, "Table \"%s\" does not 
exist"),
+    
     UNDEFINED_COLUMN(PostgreSQLState.UNDEFINED_COLUMN, "Column \"%s\" of table 
\"%s\" does not exist"),
     
     
DATA_SOURCE_REJECTED_CONNECTION_ATTEMPT(XOpenSQLState.DATA_SOURCE_REJECTED_CONNECTION_ATTEMPT,
 "server rejected establishment of sql connection"),

Reply via email to