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

duanzhengqiang 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 0cf9e3a9431 Add shardingsphere-error module (#20092)
0cf9e3a9431 is described below

commit 0cf9e3a94312d5a7fe9ca4e554c78cd1191bfc0f
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Aug 12 12:11:00 2022 +0800

    Add shardingsphere-error module (#20092)
    
    * Add shardingsphere-error module
    
    * Fix pom
---
 pom.xml                                            |   3 +-
 .../shardingsphere-db-protocol-core/pom.xml        |   6 ++
 .../shardingsphere-db-protocol-mysql/pom.xml       |   6 ++
 .../mysql/codec/MySQLPacketCodecEngine.java        |   2 +-
 .../mysql/packet/generic/MySQLErrPacket.java       |   2 +-
 .../mysql/packet/generic/MySQLErrPacketTest.java   |   2 +-
 .../shardingsphere-db-protocol-opengauss/pom.xml   |   6 ++
 .../codec/OpenGaussPacketCodecEngine.java          |   2 +-
 .../generic/OpenGaussErrorResponsePacketTest.java  |   2 +-
 .../shardingsphere-db-protocol-postgresql/pom.xml  |   6 ++
 .../codec/PostgreSQLPacketCodecEngine.java         |   2 +-
 .../generic/PostgreSQLErrorResponsePacket.java     |   2 +-
 .../generic/PostgreSQLErrorResponsePacketTest.java |   2 +-
 .../pom.xml                                        |  16 ++--
 .../shardingsphere-common-error}/pom.xml           |   6 +-
 .../error/code}/CommonErrorCode.java               |   2 +-
 .../shardingsphere/error/code}/SQLErrorCode.java   |   4 +-
 .../error/mapper}/SQLExceptionMapper.java          |   2 +-
 .../error/mapper}/SQLExceptionMapperFactory.java   |   2 +-
 .../error/code}/CommonErrorCodeTest.java           |   2 +-
 .../shardingsphere-mysql-error}/pom.xml            |   6 +-
 .../error/mysql/code}/MySQLServerErrorCode.java    |   4 +-
 .../mysql/mapper/MySQLSQLExceptionMapper.java      | 104 +++++++++++++++++++++
 ....shardingsphere.error.mapper.SQLExceptionMapper |  18 ++++
 .../mysql/code}/MySQLServerErrorCodeTest.java      |   2 +-
 .../shardingsphere-postgresql-error}/pom.xml       |  12 ++-
 .../postgresql/code}/PostgreSQLErrorCode.java      |   2 +-
 .../mapper/PostgreSQLSQLExceptionMapper.java       |  60 ++++++++++++
 ....shardingsphere.error.mapper.SQLExceptionMapper |  18 ++++
 .../ddl/ShardingDDLStatementValidator.java         |   4 +-
 ...ardingCreateFunctionStatementValidatorTest.java |   7 +-
 .../ShardingCreateIndexStatementValidatorTest.java |   2 +-
 ...rdingCreateProcedureStatementValidatorTest.java |   7 +-
 .../ShardingCreateTableStatementValidatorTest.java |   2 +-
 .../ShardingSphereConfigurationException.java      |   4 +-
 .../InsertColumnsAndValuesMismatchedException.java |   3 +-
 .../infra}/exception/NoSuchTableException.java     |   6 +-
 .../infra}/exception/TableExistsException.java     |   6 +-
 .../shardingsphere-infra-parser/pom.xml            |   1 +
 .../client/netty/MySQLNegotiateHandlerTest.java    |   2 +-
 .../common/exception/CommonDistSQLErrorCode.java   |   2 +-
 .../shardingsphere-proxy-frontend-mysql/pom.xml    |   5 +
 .../authentication/MySQLAuthenticationEngine.java  |   2 +-
 .../authentication/MySQLAuthenticationHandler.java |   2 +-
 .../frontend/mysql/err/MySQLErrPacketFactory.java  |  75 ++-------------
 .../MySQLAuthenticationEngineTest.java             |   2 +-
 .../MySQLAuthenticationHandlerTest.java            |   2 +-
 .../mysql/err/MySQLErrPacketFactoryTest.java       |   4 +-
 .../OpenGaussAuthenticationEngine.java             |   2 +-
 .../OpenGaussAuthenticationHandler.java            |   2 +-
 .../opengauss/err/OpenGaussErrorPacketFactory.java |  11 ++-
 .../OpenGaussAuthenticationHandlerTest.java        |   2 +-
 .../PostgreSQLAuthenticationEngine.java            |   2 +-
 .../PostgreSQLAuthenticationHandler.java           |   2 +-
 .../authentication/PostgreSQLLoginResult.java      |   2 +-
 .../PostgreSQLAuthenticationException.java         |   2 +-
 .../PostgreSQLUnsupportedCommandExecutor.java      |   2 +-
 .../describe/PostgreSQLComDescribeExecutor.java    |   2 +-
 .../postgresql/err/PostgreSQLErrPacketFactory.java |  24 +----
 .../PostgreSQLAuthenticationHandlerTest.java       |   2 +-
 .../PostgreSQLComDescribeExecutorTest.java         |   2 +-
 .../sql/parser/exception/SQLParsingException.java  |   4 +-
 .../test/integration/engine/ddl/BaseDDLIT.java     |   2 +-
 63 files changed, 337 insertions(+), 167 deletions(-)

diff --git a/pom.xml b/pom.xml
index 9b1a327aadb..2b286d445f6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,10 +32,11 @@
     <description>Build criterion and ecosystem above multi-model 
databases</description>
     
     <modules>
+        <module>shardingsphere-infra</module>
+        <module>shardingsphere-error</module>
         <module>shardingsphere-sql-parser</module>
         <module>shardingsphere-distsql</module>
         <module>shardingsphere-db-protocol</module>
-        <module>shardingsphere-infra</module>
         <module>shardingsphere-mode</module>
         <module>shardingsphere-kernel</module>
         
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/pom.xml 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/pom.xml
index da43aa520de..186ea5b49af 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/pom.xml
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/pom.xml
@@ -28,6 +28,12 @@
     <name>${project.artifactId}</name>
     
     <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-common-error</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        
         <dependency>
             <groupId>io.netty</groupId>
             <artifactId>netty-codec</artifactId>
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml
index 396cef3e78f..93af12cfede 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml
@@ -33,5 +33,11 @@
             <artifactId>shardingsphere-db-protocol-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-mysql-error</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 </project>
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngine.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngine.java
index 3e1f1708c26..02601bd7c2e 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngine.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngine.java
@@ -22,10 +22,10 @@ import io.netty.buffer.CompositeByteBuf;
 import io.netty.channel.ChannelHandlerContext;
 import org.apache.shardingsphere.db.protocol.CommonConstants;
 import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
-import org.apache.shardingsphere.db.protocol.error.CommonErrorCode;
 import org.apache.shardingsphere.db.protocol.mysql.packet.MySQLPacket;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLErrPacket;
 import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
+import org.apache.shardingsphere.error.code.CommonErrorCode;
 
 import java.nio.charset.Charset;
 import java.util.Iterator;
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacket.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacket.java
index 00e7e99acee..c87a3e79024 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacket.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacket.java
@@ -20,9 +20,9 @@ package 
org.apache.shardingsphere.db.protocol.mysql.packet.generic;
 import com.google.common.base.Preconditions;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.db.protocol.error.SQLErrorCode;
 import org.apache.shardingsphere.db.protocol.mysql.packet.MySQLPacket;
 import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
+import org.apache.shardingsphere.error.code.SQLErrorCode;
 
 /**
  * ERR packet protocol for MySQL.
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
index 08ac407c5fe..3fd720a92a5 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
@@ -17,7 +17,7 @@
 
 package org.apache.shardingsphere.db.protocol.mysql.packet.generic;
 
-import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerErrorCode;
+import org.apache.shardingsphere.error.mysql.code.MySQLServerErrorCode;
 import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/pom.xml 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/pom.xml
index 59411de0675..ebcb1b5429e 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/pom.xml
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/pom.xml
@@ -33,5 +33,11 @@
             <artifactId>shardingsphere-db-protocol-postgresql</artifactId>
             <version>${project.version}</version>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-postgresql-error</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 </project>
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/codec/OpenGaussPacketCodecEngine.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/codec/OpenGaussPacketCodecEngine.java
index 60f5aebd6b7..f79b29f0a28 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/codec/OpenGaussPacketCodecEngine.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/codec/OpenGaussPacketCodecEngine.java
@@ -25,7 +25,7 @@ import 
org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
 import 
org.apache.shardingsphere.db.protocol.opengauss.packet.command.OpenGaussCommandPacketType;
 import 
org.apache.shardingsphere.db.protocol.opengauss.packet.command.generic.OpenGaussErrorResponsePacket;
 import org.apache.shardingsphere.db.protocol.packet.CommandPacketType;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLMessageSeverityLevel;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.PostgreSQLPacket;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java
index fbf48c66c7f..fafd725436b 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java
@@ -17,7 +17,7 @@
 
 package org.apache.shardingsphere.db.protocol.opengauss.packet.command.generic;
 
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLMessageSeverityLevel;
 import 
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
 import org.junit.Test;
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/pom.xml 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/pom.xml
index 24eef73358f..ace3effbf46 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/pom.xml
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/pom.xml
@@ -33,5 +33,11 @@
             <artifactId>shardingsphere-db-protocol-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-postgresql-error</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 </project>
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/codec/PostgreSQLPacketCodecEngine.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/codec/PostgreSQLPacketCodecEngine.java
index c601901b156..a8df939c0f2 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/codec/PostgreSQLPacketCodecEngine.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/codec/PostgreSQLPacketCodecEngine.java
@@ -22,7 +22,7 @@ import io.netty.buffer.CompositeByteBuf;
 import io.netty.channel.ChannelHandlerContext;
 import org.apache.shardingsphere.db.protocol.CommonConstants;
 import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLMessageSeverityLevel;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.PostgreSQLPacket;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacket.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacket.java
index 688af6007e8..3ca3daa3f80 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacket.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacket.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.db.protocol.postgresql.packet.generic;
 
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLIdentifierPacket;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLIdentifierTag;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacketTest.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacketTest.java
index 04c46fbfe89..2f5616aad80 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacketTest.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacketTest.java
@@ -17,7 +17,7 @@
 
 package org.apache.shardingsphere.db.protocol.postgresql.packet.generic;
 
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLMessageSeverityLevel;
 import 
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
 import org.junit.Test;
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/pom.xml 
b/shardingsphere-error/pom.xml
similarity index 80%
copy from shardingsphere-db-protocol/shardingsphere-db-protocol-core/pom.xml
copy to shardingsphere-error/pom.xml
index da43aa520de..deae4987db1 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/pom.xml
+++ b/shardingsphere-error/pom.xml
@@ -21,16 +21,16 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-db-protocol</artifactId>
+        <artifactId>shardingsphere</artifactId>
         <version>5.1.3-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-db-protocol-core</artifactId>
+    <artifactId>shardingsphere-error</artifactId>
+    <packaging>pom</packaging>
     <name>${project.artifactId}</name>
     
-    <dependencies>
-        <dependency>
-            <groupId>io.netty</groupId>
-            <artifactId>netty-codec</artifactId>
-        </dependency>
-    </dependencies>
+    <modules>
+        <module>shardingsphere-common-error</module>
+        <module>shardingsphere-mysql-error</module>
+        <module>shardingsphere-postgresql-error</module>
+    </modules>
 </project>
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml 
b/shardingsphere-error/shardingsphere-common-error/pom.xml
similarity index 88%
copy from shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml
copy to shardingsphere-error/shardingsphere-common-error/pom.xml
index 396cef3e78f..e9dd911554c 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml
+++ b/shardingsphere-error/shardingsphere-common-error/pom.xml
@@ -21,16 +21,16 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-db-protocol</artifactId>
+        <artifactId>shardingsphere-error</artifactId>
         <version>5.1.3-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-db-protocol-mysql</artifactId>
+    <artifactId>shardingsphere-common-error</artifactId>
     <name>${project.artifactId}</name>
     
     <dependencies>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-db-protocol-core</artifactId>
+            <artifactId>shardingsphere-infra-common</artifactId>
             <version>${project.version}</version>
         </dependency>
     </dependencies>
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
 
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/CommonErrorCode.java
similarity index 97%
rename from 
shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
rename to 
shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/CommonErrorCode.java
index 3c52d16586b..53383fe8da7 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
+++ 
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/CommonErrorCode.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.db.protocol.error;
+package org.apache.shardingsphere.error.code;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLErrorCode.java
 
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/SQLErrorCode.java
similarity index 94%
rename from 
shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLErrorCode.java
rename to 
shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/SQLErrorCode.java
index e11d6479182..1a2c4a222ee 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLErrorCode.java
+++ 
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/SQLErrorCode.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.db.protocol.error;
+package org.apache.shardingsphere.error.code;
 
 /**
  * SQL error code.
@@ -36,7 +36,7 @@ public interface SQLErrorCode {
      */
     String getSqlState();
     
-    /**
+    /**MySQLErrPacketFactory
      * Get error message.
      * 
      * @return error message
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapper.java
 
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/mapper/SQLExceptionMapper.java
similarity index 96%
rename from 
shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapper.java
rename to 
shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/mapper/SQLExceptionMapper.java
index 6257d5ec047..329a2d14209 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapper.java
+++ 
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/mapper/SQLExceptionMapper.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.db.protocol.error;
+package org.apache.shardingsphere.error.mapper;
 
 import 
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
 import org.apache.shardingsphere.infra.util.spi.annotation.SingletonSPI;
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapperFactory.java
 
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/mapper/SQLExceptionMapperFactory.java
similarity index 96%
rename from 
shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapperFactory.java
rename to 
shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/mapper/SQLExceptionMapperFactory.java
index 337d4573adb..a80d7da9d7c 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapperFactory.java
+++ 
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/mapper/SQLExceptionMapperFactory.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.db.protocol.error;
+package org.apache.shardingsphere.error.mapper;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/test/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCodeTest.java
 
b/shardingsphere-error/shardingsphere-common-error/src/test/java/org/apache/shardingsphere/error/code/CommonErrorCodeTest.java
similarity index 97%
rename from 
shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/test/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCodeTest.java
rename to 
shardingsphere-error/shardingsphere-common-error/src/test/java/org/apache/shardingsphere/error/code/CommonErrorCodeTest.java
index c71c8249cd6..ef2b1c035a0 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/test/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCodeTest.java
+++ 
b/shardingsphere-error/shardingsphere-common-error/src/test/java/org/apache/shardingsphere/error/code/CommonErrorCodeTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.db.protocol.error;
+package org.apache.shardingsphere.error.code;
 
 import org.junit.Test;
 
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml 
b/shardingsphere-error/shardingsphere-mysql-error/pom.xml
similarity index 88%
copy from shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml
copy to shardingsphere-error/shardingsphere-mysql-error/pom.xml
index 396cef3e78f..44c89ac3eb6 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml
+++ b/shardingsphere-error/shardingsphere-mysql-error/pom.xml
@@ -21,16 +21,16 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-db-protocol</artifactId>
+        <artifactId>shardingsphere-error</artifactId>
         <version>5.1.3-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-db-protocol-mysql</artifactId>
+    <artifactId>shardingsphere-mysql-error</artifactId>
     <name>${project.artifactId}</name>
     
     <dependencies>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-db-protocol-core</artifactId>
+            <artifactId>shardingsphere-common-error</artifactId>
             <version>${project.version}</version>
         </dependency>
     </dependencies>
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerErrorCode.java
 
b/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/code/MySQLServerErrorCode.java
similarity index 95%
rename from 
shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerErrorCode.java
rename to 
shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/code/MySQLServerErrorCode.java
index 7dc22c1a0d8..7adde3c8a40 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerErrorCode.java
+++ 
b/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/code/MySQLServerErrorCode.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.db.protocol.mysql.constant;
+package org.apache.shardingsphere.error.mysql.code;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.db.protocol.error.SQLErrorCode;
+import org.apache.shardingsphere.error.code.SQLErrorCode;
 
 /**
  * Server error code for MySQL.
diff --git 
a/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/mapper/MySQLSQLExceptionMapper.java
 
b/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/mapper/MySQLSQLExceptionMapper.java
new file mode 100644
index 00000000000..f341e78cb45
--- /dev/null
+++ 
b/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/mapper/MySQLSQLExceptionMapper.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.error.mysql.mapper;
+
+import org.apache.shardingsphere.error.code.CommonErrorCode;
+import org.apache.shardingsphere.error.code.SQLErrorCode;
+import org.apache.shardingsphere.error.mapper.SQLExceptionMapper;
+import org.apache.shardingsphere.error.mysql.code.MySQLServerErrorCode;
+import 
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
+import org.apache.shardingsphere.infra.exception.CircuitBreakException;
+import org.apache.shardingsphere.infra.exception.DBCreateExistsException;
+import org.apache.shardingsphere.infra.exception.DBDropNotExistsException;
+import 
org.apache.shardingsphere.infra.exception.InsertColumnsAndValuesMismatchedException;
+import org.apache.shardingsphere.infra.exception.NoDatabaseSelectedException;
+import org.apache.shardingsphere.infra.exception.NoSuchTableException;
+import org.apache.shardingsphere.infra.exception.ResourceNotExistedException;
+import org.apache.shardingsphere.infra.exception.RuleNotExistedException;
+import org.apache.shardingsphere.infra.exception.TableExistsException;
+import org.apache.shardingsphere.infra.exception.TableLockWaitTimeoutException;
+import org.apache.shardingsphere.infra.exception.TableLockedException;
+import 
org.apache.shardingsphere.infra.exception.TableModifyInTransactionException;
+import org.apache.shardingsphere.infra.exception.UnknownDatabaseException;
+import 
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
+import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
+
+import java.sql.SQLException;
+
+/**
+ * SQL exception mapper for MySQL.
+ */
+public final class MySQLSQLExceptionMapper implements SQLExceptionMapper {
+    
+    @Override
+    public SQLException convert(final ShardingSphereInsideException 
insideException) {
+        if (insideException instanceof TableModifyInTransactionException) {
+            return 
toSQLException(MySQLServerErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE, 
((TableModifyInTransactionException) insideException).getTableName());
+        }
+        if (insideException instanceof 
InsertColumnsAndValuesMismatchedException) {
+            return 
toSQLException(MySQLServerErrorCode.ER_WRONG_VALUE_COUNT_ON_ROW, 
((InsertColumnsAndValuesMismatchedException) 
insideException).getMismatchedRowNumber());
+        }
+        if (insideException instanceof UnknownDatabaseException) {
+            return null != ((UnknownDatabaseException) 
insideException).getDatabaseName()
+                    ? toSQLException(MySQLServerErrorCode.ER_BAD_DB_ERROR, 
((UnknownDatabaseException) insideException).getDatabaseName())
+                    : toSQLException(MySQLServerErrorCode.ER_NO_DB_ERROR);
+        }
+        if (insideException instanceof NoDatabaseSelectedException) {
+            return toSQLException(MySQLServerErrorCode.ER_NO_DB_ERROR);
+        }
+        if (insideException instanceof DBCreateExistsException) {
+            return 
toSQLException(MySQLServerErrorCode.ER_DB_CREATE_EXISTS_ERROR, 
((DBCreateExistsException) insideException).getDatabaseName());
+        }
+        if (insideException instanceof DBDropNotExistsException) {
+            return 
toSQLException(MySQLServerErrorCode.ER_DB_DROP_NOT_EXISTS_ERROR, 
((DBDropNotExistsException) insideException).getDatabaseName());
+        }
+        if (insideException instanceof TableExistsException) {
+            return toSQLException(MySQLServerErrorCode.ER_TABLE_EXISTS_ERROR, 
((TableExistsException) insideException).getTableName());
+        }
+        if (insideException instanceof NoSuchTableException) {
+            return toSQLException(MySQLServerErrorCode.ER_NO_SUCH_TABLE, 
((NoSuchTableException) insideException).getTableName());
+        }
+        if (insideException instanceof CircuitBreakException) {
+            return toSQLException(CommonErrorCode.CIRCUIT_BREAK_MODE);
+        }
+        if (insideException instanceof ShardingSphereConfigurationException || 
insideException instanceof SQLParsingException) {
+            return toSQLException(MySQLServerErrorCode.ER_NOT_SUPPORTED_YET, 
insideException.getMessage());
+        }
+        if (insideException instanceof RuleNotExistedException || 
insideException instanceof ResourceNotExistedException) {
+            return toSQLException(MySQLServerErrorCode.ER_SP_DOES_NOT_EXIST);
+        }
+        if (insideException instanceof TableLockWaitTimeoutException) {
+            TableLockWaitTimeoutException exception = 
(TableLockWaitTimeoutException) insideException;
+            return toSQLException(CommonErrorCode.TABLE_LOCK_WAIT_TIMEOUT, 
exception.getTableName(), exception.getSchemaName(), 
exception.getTimeoutMilliseconds());
+        }
+        if (insideException instanceof TableLockedException) {
+            TableLockedException exception = (TableLockedException) 
insideException;
+            return toSQLException(CommonErrorCode.TABLE_LOCKED, 
exception.getTableName(), exception.getSchemaName());
+        }
+        return toSQLException(CommonErrorCode.UNKNOWN_EXCEPTION, 
insideException.getMessage());
+    }
+    
+    private SQLException toSQLException(final SQLErrorCode errorCode, final 
Object... messageArguments) {
+        return new SQLException(String.format(errorCode.getErrorMessage(), 
messageArguments), errorCode.getSqlState(), errorCode.getErrorCode());
+    }
+    
+    @Override
+    public String getType() {
+        return "MySQL";
+    }
+}
diff --git 
a/shardingsphere-error/shardingsphere-mysql-error/src/main/resources/META-INF/services/org.apache.shardingsphere.error.mapper.SQLExceptionMapper
 
b/shardingsphere-error/shardingsphere-mysql-error/src/main/resources/META-INF/services/org.apache.shardingsphere.error.mapper.SQLExceptionMapper
new file mode 100644
index 00000000000..b403b5826a3
--- /dev/null
+++ 
b/shardingsphere-error/shardingsphere-mysql-error/src/main/resources/META-INF/services/org.apache.shardingsphere.error.mapper.SQLExceptionMapper
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.shardingsphere.error.mysql.mapper.MySQLSQLExceptionMapper
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerErrorCodeTest.java
 
b/shardingsphere-error/shardingsphere-mysql-error/src/test/java/org/apache/shardingsphere/error/mysql/code/MySQLServerErrorCodeTest.java
similarity index 97%
rename from 
shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerErrorCodeTest.java
rename to 
shardingsphere-error/shardingsphere-mysql-error/src/test/java/org/apache/shardingsphere/error/mysql/code/MySQLServerErrorCodeTest.java
index 305caedea69..8eac61062e1 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerErrorCodeTest.java
+++ 
b/shardingsphere-error/shardingsphere-mysql-error/src/test/java/org/apache/shardingsphere/error/mysql/code/MySQLServerErrorCodeTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.db.protocol.mysql.constant;
+package org.apache.shardingsphere.error.mysql.code;
 
 import org.junit.Test;
 
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml 
b/shardingsphere-error/shardingsphere-postgresql-error/pom.xml
similarity index 80%
copy from shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml
copy to shardingsphere-error/shardingsphere-postgresql-error/pom.xml
index 396cef3e78f..dde5e7e94db 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/pom.xml
+++ b/shardingsphere-error/shardingsphere-postgresql-error/pom.xml
@@ -21,17 +21,23 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-db-protocol</artifactId>
+        <artifactId>shardingsphere-error</artifactId>
         <version>5.1.3-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-db-protocol-mysql</artifactId>
+    <artifactId>shardingsphere-postgresql-error</artifactId>
     <name>${project.artifactId}</name>
     
     <dependencies>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-db-protocol-core</artifactId>
+            <artifactId>shardingsphere-common-error</artifactId>
             <version>${project.version}</version>
         </dependency>
+        
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLErrorCode.java
 
b/shardingsphere-error/shardingsphere-postgresql-error/src/main/java/org/apache/shardingsphere/error/postgresql/code/PostgreSQLErrorCode.java
similarity index 97%
rename from 
shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLErrorCode.java
rename to 
shardingsphere-error/shardingsphere-postgresql-error/src/main/java/org/apache/shardingsphere/error/postgresql/code/PostgreSQLErrorCode.java
index 652f6248f49..6fe2a0b3e61 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLErrorCode.java
+++ 
b/shardingsphere-error/shardingsphere-postgresql-error/src/main/java/org/apache/shardingsphere/error/postgresql/code/PostgreSQLErrorCode.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.db.protocol.postgresql.constant;
+package org.apache.shardingsphere.error.postgresql.code;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
diff --git 
a/shardingsphere-error/shardingsphere-postgresql-error/src/main/java/org/apache/shardingsphere/error/postgresql/mapper/PostgreSQLSQLExceptionMapper.java
 
b/shardingsphere-error/shardingsphere-postgresql-error/src/main/java/org/apache/shardingsphere/error/postgresql/mapper/PostgreSQLSQLExceptionMapper.java
new file mode 100644
index 00000000000..fabc08193c5
--- /dev/null
+++ 
b/shardingsphere-error/shardingsphere-postgresql-error/src/main/java/org/apache/shardingsphere/error/postgresql/mapper/PostgreSQLSQLExceptionMapper.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.error.postgresql.mapper;
+
+import org.apache.shardingsphere.error.mapper.SQLExceptionMapper;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
+import org.apache.shardingsphere.infra.exception.DBCreateExistsException;
+import org.apache.shardingsphere.infra.exception.InTransactionException;
+import 
org.apache.shardingsphere.infra.exception.InsertColumnsAndValuesMismatchedException;
+import 
org.apache.shardingsphere.infra.exception.InvalidParameterValueException;
+import 
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
+import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
+
+import java.sql.SQLException;
+
+/**
+ * SQL exception mapper for PostgreSQL.
+ */
+public final class PostgreSQLSQLExceptionMapper implements SQLExceptionMapper {
+    
+    @Override
+    public SQLException convert(final ShardingSphereInsideException 
insideException) {
+        if (insideException instanceof InTransactionException) {
+            return new PSQLException(insideException.getMessage(), 
PSQLState.TRANSACTION_STATE_INVALID);
+        }
+        if (insideException instanceof 
InsertColumnsAndValuesMismatchedException) {
+            return new PSQLException(insideException.getMessage(), 
PSQLState.SYNTAX_ERROR);
+        }
+        if (insideException instanceof InvalidParameterValueException) {
+            InvalidParameterValueException invalidParameterValueException = 
(InvalidParameterValueException) insideException;
+            String message = String.format("invalid value for parameter 
\"%s\": \"%s\"", invalidParameterValueException.getParameterName(), 
invalidParameterValueException.getParameterValue());
+            return new PSQLException(message, 
PSQLState.INVALID_PARAMETER_VALUE);
+        }
+        if (insideException instanceof DBCreateExistsException) {
+            return new 
PSQLException(PostgreSQLErrorCode.DUPLICATE_DATABASE.getConditionName(), null);
+        }
+        return new PSQLException(insideException.getMessage(), null);
+    }
+    
+    @Override
+    public String getType() {
+        return "PostgreSQL";
+    }
+}
diff --git 
a/shardingsphere-error/shardingsphere-postgresql-error/src/main/resources/META-INF/services/org.apache.shardingsphere.error.mapper.SQLExceptionMapper
 
b/shardingsphere-error/shardingsphere-postgresql-error/src/main/resources/META-INF/services/org.apache.shardingsphere.error.mapper.SQLExceptionMapper
new file mode 100644
index 00000000000..f6b7ab704e7
--- /dev/null
+++ 
b/shardingsphere-error/shardingsphere-postgresql-error/src/main/resources/META-INF/services/org.apache.shardingsphere.error.mapper.SQLExceptionMapper
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.shardingsphere.error.postgresql.mapper.PostgreSQLSQLExceptionMapper
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java
index 096f4f1b8fb..1b98acb6714 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java
@@ -20,8 +20,8 @@ package 
org.apache.shardingsphere.sharding.route.engine.validator.ddl;
 import org.apache.shardingsphere.infra.exception.ShardingSphereException;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException;
+import org.apache.shardingsphere.infra.exception.NoSuchTableException;
+import org.apache.shardingsphere.infra.exception.TableExistsException;
 import 
org.apache.shardingsphere.sharding.route.engine.validator.ShardingStatementValidator;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.index.IndexSegment;
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateFunctionStatementValidatorTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateFunctionStatementValidatorTest.java
index ceef5a87c08..ee5e9db45f3 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateFunctionStatementValidatorTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateFunctionStatementValidatorTest.java
@@ -20,10 +20,9 @@ package 
org.apache.shardingsphere.sharding.route.engine.validator.ddl;
 import 
org.apache.shardingsphere.infra.binder.statement.CommonSQLStatementContext;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import org.apache.shardingsphere.infra.database.DefaultDatabase;
-import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.exception.NoSuchTableException;
+import org.apache.shardingsphere.infra.exception.TableExistsException;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException;
 import 
org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingCreateFunctionStatementValidator;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.routine.RoutineBodySegment;
@@ -74,7 +73,7 @@ public final class 
ShardingCreateFunctionStatementValidatorTest {
         new 
ShardingCreateFunctionStatementValidator().preValidate(shardingRule, 
sqlStatementContext, Collections.emptyList(), database);
     }
     
-    @Test(expected = ShardingSphereException.class)
+    @Test(expected = NoSuchTableException.class)
     public void assertPreValidateCreateFunctionWithShardingTableForMySQL() {
         MySQLSelectStatement selectStatement = new MySQLSelectStatement();
         selectStatement.setFrom(new SimpleTableSegment(new TableNameSegment(0, 
0, new IdentifierValue("t_order"))));
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateIndexStatementValidatorTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateIndexStatementValidatorTest.java
index 1de2221d7ee..7b55181a6d2 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateIndexStatementValidatorTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateIndexStatementValidatorTest.java
@@ -21,7 +21,7 @@ import 
org.apache.shardingsphere.infra.binder.statement.ddl.CreateIndexStatement
 import org.apache.shardingsphere.infra.exception.ShardingSphereException;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereTable;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException;
+import org.apache.shardingsphere.infra.exception.NoSuchTableException;
 import 
org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingCreateIndexStatementValidator;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.index.IndexNameSegment;
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateProcedureStatementValidatorTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateProcedureStatementValidatorTest.java
index 8fef56e2faf..ca179366462 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateProcedureStatementValidatorTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateProcedureStatementValidatorTest.java
@@ -20,10 +20,9 @@ package 
org.apache.shardingsphere.sharding.route.engine.validator.ddl;
 import 
org.apache.shardingsphere.infra.binder.statement.CommonSQLStatementContext;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import org.apache.shardingsphere.infra.database.DefaultDatabase;
-import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.exception.NoSuchTableException;
+import org.apache.shardingsphere.infra.exception.TableExistsException;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException;
 import 
org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingCreateProcedureStatementValidator;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.routine.RoutineBodySegment;
@@ -75,7 +74,7 @@ public final class 
ShardingCreateProcedureStatementValidatorTest {
         new 
ShardingCreateProcedureStatementValidator().preValidate(shardingRule, 
sqlStatementContext, Collections.emptyList(), database);
     }
     
-    @Test(expected = ShardingSphereException.class)
+    @Test(expected = NoSuchTableException.class)
     public void assertPreValidateCreateProcedureWithShardingTableForMySQL() {
         MySQLSelectStatement selectStatement = new MySQLSelectStatement();
         selectStatement.setFrom(new SimpleTableSegment(new TableNameSegment(0, 
0, new IdentifierValue("t_order"))));
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateTableStatementValidatorTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateTableStatementValidatorTest.java
index 26666bb35eb..47f911b6301 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateTableStatementValidatorTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateTableStatementValidatorTest.java
@@ -25,7 +25,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.infra.route.context.RouteMapper;
 import org.apache.shardingsphere.infra.route.context.RouteUnit;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException;
+import org.apache.shardingsphere.infra.exception.TableExistsException;
 import 
org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingCreateTableStatementValidator;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import org.apache.shardingsphere.sharding.rule.TableRule;
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
index b47ca3555c5..29941287d4f 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
@@ -17,10 +17,12 @@
 
 package org.apache.shardingsphere.infra.config.exception;
 
+import 
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
+
 /**
  * Configuration exception.
  */
-public final class ShardingSphereConfigurationException extends 
RuntimeException {
+public final class ShardingSphereConfigurationException extends 
ShardingSphereInsideException {
     
     private static final long serialVersionUID = -1360264079938958332L;
     
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/InsertColumnsAndValuesMismatchedException.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/InsertColumnsAndValuesMismatchedException.java
index 53f6ac3a7ca..343861964fe 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/InsertColumnsAndValuesMismatchedException.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/InsertColumnsAndValuesMismatchedException.java
@@ -18,12 +18,13 @@
 package org.apache.shardingsphere.infra.exception;
 
 import lombok.Getter;
+import 
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
 
 /**
  * Insert columns and values mismatched exception.
  */
 @Getter
-public final class InsertColumnsAndValuesMismatchedException extends 
ShardingSphereException {
+public final class InsertColumnsAndValuesMismatchedException extends 
ShardingSphereInsideException {
     
     private static final long serialVersionUID = 5676889868213244575L;
     
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/exception/NoSuchTableException.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/NoSuchTableException.java
similarity index 84%
rename from 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/exception/NoSuchTableException.java
rename to 
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/NoSuchTableException.java
index b5664ecc0f6..171b257a049 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/exception/NoSuchTableException.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/NoSuchTableException.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.route.engine.exception;
+package org.apache.shardingsphere.infra.exception;
 
 import lombok.Getter;
-import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import 
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
 
 /**
  * No such table exception.
  */
 @Getter
-public final class NoSuchTableException extends ShardingSphereException {
+public final class NoSuchTableException extends ShardingSphereInsideException {
     
     private static final long serialVersionUID = 8311953084941769743L;
     
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/exception/TableExistsException.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableExistsException.java
similarity index 84%
rename from 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/exception/TableExistsException.java
rename to 
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableExistsException.java
index e5beb5a407f..98119de2810 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/exception/TableExistsException.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableExistsException.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.route.engine.exception;
+package org.apache.shardingsphere.infra.exception;
 
 import lombok.Getter;
-import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import 
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
 
 /**
  * Table exists exception.
  */
 @Getter
-public final class TableExistsException extends ShardingSphereException {
+public final class TableExistsException extends ShardingSphereInsideException {
     
     private static final long serialVersionUID = 6056681626545854214L;
     
diff --git a/shardingsphere-infra/shardingsphere-infra-parser/pom.xml 
b/shardingsphere-infra/shardingsphere-infra-parser/pom.xml
index ecbe3443068..bb55515287f 100644
--- a/shardingsphere-infra/shardingsphere-infra-parser/pom.xml
+++ b/shardingsphere-infra/shardingsphere-infra-parser/pom.xml
@@ -38,6 +38,7 @@
             <artifactId>shardingsphere-infra-common</artifactId>
             <version>${project.version}</version>
         </dependency>
+        
         <dependency>
             <groupId>com.github.ben-manes.caffeine</groupId>
             <artifactId>caffeine</artifactId>
diff --git 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLNegotiateHandlerTest.java
 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLNegotiateHandlerTest.java
index c3b7f756ae6..8cd21f0a8dc 100644
--- 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLNegotiateHandlerTest.java
+++ 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLNegotiateHandlerTest.java
@@ -24,7 +24,7 @@ import io.netty.util.concurrent.Promise;
 import org.apache.shardingsphere.data.pipeline.core.util.ReflectionUtil;
 import org.apache.shardingsphere.data.pipeline.mysql.ingest.client.ServerInfo;
 import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLAuthenticationMethod;
-import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerErrorCode;
+import org.apache.shardingsphere.error.mysql.code.MySQLServerErrorCode;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLErrPacket;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLOKPacket;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.handshake.MySQLAuthPluginData;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/CommonDistSQLErrorCode.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/CommonDistSQLErrorCode.java
index 96cd43a9f40..5b6a7da3a74 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/CommonDistSQLErrorCode.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/CommonDistSQLErrorCode.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.excep
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.db.protocol.error.SQLErrorCode;
+import org.apache.shardingsphere.error.code.SQLErrorCode;
 
 /**
  * Common dist sql error code.
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/pom.xml
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/pom.xml
index d66f343db42..441da5d5c42 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/pom.xml
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/pom.xml
@@ -38,6 +38,11 @@
             <artifactId>shardingsphere-proxy-frontend-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-mysql-error</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-db-protocol-mysql</artifactId>
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
index 8a5a0fcd738..551b0e7663e 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
@@ -24,7 +24,7 @@ import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLCapabilityFlag;
 import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLCharacterSet;
 import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLConnectionPhase;
 import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLConstants;
-import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerErrorCode;
+import org.apache.shardingsphere.error.mysql.code.MySQLServerErrorCode;
 import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLStatusFlag;
 import 
org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.MySQLStatementIDGenerator;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLErrPacket;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandler.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandler.java
index b0c3f87cd62..9529217cd00 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandler.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandler.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.proxy.frontend.mysql.authentication;
 
 import lombok.Getter;
-import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerErrorCode;
+import org.apache.shardingsphere.error.mysql.code.MySQLServerErrorCode;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.handshake.MySQLAuthPluginData;
 import org.apache.shardingsphere.infra.executor.check.SQLCheckEngine;
 import org.apache.shardingsphere.infra.metadata.user.Grantee;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
index cf7fc30f067..8cbb5fcf2d5 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
@@ -21,29 +21,16 @@ import com.google.common.base.Strings;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import 
org.apache.shardingsphere.data.pipeline.core.exception.PipelineJobNotFoundException;
-import org.apache.shardingsphere.db.protocol.error.CommonErrorCode;
-import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerErrorCode;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLErrPacket;
-import 
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
-import 
org.apache.shardingsphere.infra.exception.InsertColumnsAndValuesMismatchedException;
-import org.apache.shardingsphere.infra.exception.NoDatabaseSelectedException;
-import org.apache.shardingsphere.infra.exception.UnknownDatabaseException;
-import org.apache.shardingsphere.infra.exception.CircuitBreakException;
-import org.apache.shardingsphere.infra.exception.DBCreateExistsException;
-import org.apache.shardingsphere.infra.exception.DBDropNotExistsException;
-import org.apache.shardingsphere.infra.exception.ResourceNotExistedException;
-import org.apache.shardingsphere.infra.exception.RuleNotExistedException;
-import org.apache.shardingsphere.infra.exception.TableLockWaitTimeoutException;
-import org.apache.shardingsphere.infra.exception.TableLockedException;
-import 
org.apache.shardingsphere.infra.exception.TableModifyInTransactionException;
+import org.apache.shardingsphere.error.code.CommonErrorCode;
+import org.apache.shardingsphere.error.mapper.SQLExceptionMapperFactory;
+import org.apache.shardingsphere.error.mysql.code.MySQLServerErrorCode;
+import 
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.CommonDistSQLErrorCode;
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.CommonDistSQLException;
 import 
org.apache.shardingsphere.proxy.frontend.exception.FrontendTooManyConnectionsException;
 import 
org.apache.shardingsphere.proxy.frontend.exception.UnsupportedCommandException;
 import 
org.apache.shardingsphere.proxy.frontend.exception.UnsupportedPreparedStatementException;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException;
-import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
 
 import java.nio.charset.UnsupportedCharsetException;
 import java.sql.SQLException;
@@ -66,61 +53,20 @@ public final class MySQLErrPacketFactory {
             return null == sqlException.getSQLState() ? new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_INTERNAL_ERROR, getErrorMessage(sqlException))
                     : new MySQLErrPacket(1, sqlException.getErrorCode(), 
sqlException.getSQLState(), sqlException.getMessage());
         }
+        if (cause instanceof ShardingSphereInsideException) {
+            SQLException sqlException = 
SQLExceptionMapperFactory.getInstance("MySQL").convert((ShardingSphereInsideException)
 cause);
+            return new MySQLErrPacket(1, sqlException.getErrorCode(), 
sqlException.getSQLState(), sqlException.getMessage());
+        }
         if (cause instanceof CommonDistSQLException) {
             CommonDistSQLException commonDistSQLException = 
(CommonDistSQLException) cause;
             return new MySQLErrPacket(1, 
CommonDistSQLErrorCode.valueOf(commonDistSQLException), 
commonDistSQLException.getVariable());
         }
-        if (cause instanceof TableModifyInTransactionException) {
-            return new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE, 
((TableModifyInTransactionException) cause).getTableName());
-        }
-        if (cause instanceof InsertColumnsAndValuesMismatchedException) {
-            return new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_WRONG_VALUE_COUNT_ON_ROW, 
((InsertColumnsAndValuesMismatchedException) cause).getMismatchedRowNumber());
-        }
-        if (cause instanceof UnknownDatabaseException) {
-            return null != ((UnknownDatabaseException) cause).getDatabaseName()
-                    ? new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_BAD_DB_ERROR, ((UnknownDatabaseException) 
cause).getDatabaseName())
-                    : new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_NO_DB_ERROR);
-        }
-        if (cause instanceof NoDatabaseSelectedException) {
-            return new MySQLErrPacket(1, MySQLServerErrorCode.ER_NO_DB_ERROR);
-        }
-        if (cause instanceof DBCreateExistsException) {
-            return new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_DB_CREATE_EXISTS_ERROR, ((DBCreateExistsException) 
cause).getDatabaseName());
-        }
-        if (cause instanceof DBDropNotExistsException) {
-            return new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_DB_DROP_NOT_EXISTS_ERROR, ((DBDropNotExistsException) 
cause).getDatabaseName());
-        }
-        if (cause instanceof TableExistsException) {
-            return new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_TABLE_EXISTS_ERROR, ((TableExistsException) 
cause).getTableName());
-        }
-        if (cause instanceof NoSuchTableException) {
-            return new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_NO_SUCH_TABLE, ((NoSuchTableException) 
cause).getTableName());
-        }
-        if (cause instanceof CircuitBreakException) {
-            return new MySQLErrPacket(1, CommonErrorCode.CIRCUIT_BREAK_MODE);
-        }
         if (cause instanceof UnsupportedCommandException) {
             return new MySQLErrPacket(1, CommonErrorCode.UNSUPPORTED_COMMAND, 
((UnsupportedCommandException) cause).getCommandType());
         }
         if (cause instanceof UnsupportedPreparedStatementException) {
             return new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_UNSUPPORTED_PS);
         }
-        if (cause instanceof ShardingSphereConfigurationException || cause 
instanceof SQLParsingException) {
-            return new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_NOT_SUPPORTED_YET, cause.getMessage());
-        }
-        if (cause instanceof RuleNotExistedException || cause instanceof 
ResourceNotExistedException) {
-            return new MySQLErrPacket(1, 
MySQLServerErrorCode.ER_SP_DOES_NOT_EXIST);
-        }
-        if (cause instanceof TableLockWaitTimeoutException) {
-            TableLockWaitTimeoutException exception = 
(TableLockWaitTimeoutException) cause;
-            return new MySQLErrPacket(1, 
CommonErrorCode.TABLE_LOCK_WAIT_TIMEOUT, exception.getTableName(),
-                    exception.getSchemaName(), 
exception.getTimeoutMilliseconds());
-        }
-        if (cause instanceof TableLockedException) {
-            TableLockedException exception = (TableLockedException) cause;
-            return new MySQLErrPacket(1, CommonErrorCode.TABLE_LOCKED, 
exception.getTableName(),
-                    exception.getSchemaName());
-        }
         if (cause instanceof PipelineJobNotFoundException) {
             return new MySQLErrPacket(1, 
CommonErrorCode.SCALING_JOB_NOT_EXIST, ((PipelineJobNotFoundException) 
cause).getJobId());
         }
@@ -137,9 +83,6 @@ public final class MySQLErrPacketFactory {
     }
     
     private static String getErrorMessage(final SQLException cause) {
-        if (null != cause.getNextException() && 
Strings.isNullOrEmpty(cause.getMessage())) {
-            return cause.getNextException().getMessage();
-        }
-        return cause.getMessage();
+        return null == cause.getNextException() || 
!Strings.isNullOrEmpty(cause.getMessage()) ? cause.getMessage() : 
cause.getNextException().getMessage();
     }
 }
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
index aef2733c2f5..d1c572f6916 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
@@ -25,7 +25,7 @@ import org.apache.shardingsphere.db.protocol.CommonConstants;
 import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLCapabilityFlag;
 import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLConnectionPhase;
 import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLConstants;
-import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerErrorCode;
+import org.apache.shardingsphere.error.mysql.code.MySQLServerErrorCode;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLErrPacket;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLOKPacket;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.handshake.MySQLAuthPluginData;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
index 94102379749..cb004eacabf 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
@@ -24,7 +24,7 @@ import 
org.apache.shardingsphere.authority.model.AuthorityRegistry;
 import org.apache.shardingsphere.authority.rule.AuthorityRule;
 import org.apache.shardingsphere.authority.rule.builder.AuthorityRuleBuilder;
 import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLAuthenticationMethod;
-import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerErrorCode;
+import org.apache.shardingsphere.error.mysql.code.MySQLServerErrorCode;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.handshake.MySQLAuthPluginData;
 import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
index 0fe3028e855..f112e088b82 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
@@ -29,8 +29,8 @@ import 
org.apache.shardingsphere.infra.exception.TableModifyInTransactionExcepti
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.UnsupportedVariableException;
 import 
org.apache.shardingsphere.proxy.frontend.exception.UnsupportedCommandException;
 import 
org.apache.shardingsphere.proxy.frontend.exception.UnsupportedPreparedStatementException;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException;
+import org.apache.shardingsphere.infra.exception.NoSuchTableException;
+import org.apache.shardingsphere.infra.exception.TableExistsException;
 import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
 import org.junit.Test;
 
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngine.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngine.java
index c896c5a650b..efa6dba206b 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngine.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngine.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.db.protocol.CommonConstants;
 import 
org.apache.shardingsphere.db.protocol.opengauss.packet.authentication.OpenGaussAuthenticationSCRAMSha256Packet;
 import org.apache.shardingsphere.db.protocol.payload.PacketPayload;
 import 
org.apache.shardingsphere.proxy.backend.handler.admin.postgresql.PostgreSQLCharacterSets;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLServerInfo;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.generic.PostgreSQLReadyForQueryPacket;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLAuthenticationOKPacket;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandler.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandler.java
index daa946c5097..9e76719fe7e 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandler.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandler.java
@@ -21,7 +21,7 @@ import com.google.common.base.Strings;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import lombok.SneakyThrows;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLPasswordMessagePacket;
 import org.apache.shardingsphere.infra.executor.check.SQLCheckEngine;
 import org.apache.shardingsphere.infra.metadata.user.Grantee;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/err/OpenGaussErrorPacketFactory.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/err/OpenGaussErrorPacketFactory.java
index 85be266fd86..275fd315297 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/err/OpenGaussErrorPacketFactory.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/err/OpenGaussErrorPacketFactory.java
@@ -22,9 +22,10 @@ import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import lombok.SneakyThrows;
 import 
org.apache.shardingsphere.db.protocol.opengauss.packet.command.generic.OpenGaussErrorResponsePacket;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLMessageSeverityLevel;
-import org.apache.shardingsphere.infra.exception.InTransactionException;
+import org.apache.shardingsphere.error.mapper.SQLExceptionMapperFactory;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
+import 
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.InvalidAuthorizationSpecificationException;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.PostgreSQLAuthenticationException;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.PostgreSQLProtocolViolationException;
@@ -71,12 +72,12 @@ public final class OpenGaussErrorPacketFactory {
         if (existsServerErrorMessage(cause)) {
             return createErrorResponsePacket(getServerErrorMessageMap(cause));
         }
-        if (cause instanceof InTransactionException) {
-            return new 
OpenGaussErrorResponsePacket(PostgreSQLMessageSeverityLevel.WARNING, 
PostgreSQLErrorCode.WARNING.getErrorCode(), cause.getMessage());
-        }
         if (cause instanceof SQLException) {
             return createErrorResponsePacket((SQLException) cause);
         }
+        if (cause instanceof ShardingSphereInsideException) {
+            return 
createErrorResponsePacket(SQLExceptionMapperFactory.getInstance("PostgreSQL").convert((ShardingSphereInsideException)
 cause));
+        }
         if (cause instanceof InvalidAuthorizationSpecificationException) {
             return new 
OpenGaussErrorResponsePacket(PostgreSQLMessageSeverityLevel.FATAL, 
PostgreSQLErrorCode.INVALID_AUTHORIZATION_SPECIFICATION.getErrorCode(), 
cause.getMessage());
         }
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandlerTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandlerTest.java
index 3f8f7cec99c..f11facdeccb 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandlerTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandlerTest.java
@@ -24,7 +24,7 @@ import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.shardingsphere.authority.config.AuthorityRuleConfiguration;
 import org.apache.shardingsphere.authority.rule.AuthorityRule;
 import org.apache.shardingsphere.authority.rule.builder.AuthorityRuleBuilder;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLPasswordMessagePacket;
 import 
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
 import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngine.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngine.java
index 77a833281fa..c3ddbeba891 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngine.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngine.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.db.protocol.CommonConstants;
 import org.apache.shardingsphere.db.protocol.payload.PacketPayload;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLAuthenticationMethod;
 import 
org.apache.shardingsphere.proxy.backend.handler.admin.postgresql.PostgreSQLCharacterSets;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLServerInfo;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.generic.PostgreSQLReadyForQueryPacket;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLAuthenticationOKPacket;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandler.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandler.java
index 27483ba0f23..a62e1fd17ab 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandler.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandler.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.proxy.frontend.postgresql.authentication;
 
 import com.google.common.base.Strings;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLPasswordMessagePacket;
 import org.apache.shardingsphere.infra.executor.check.SQLCheckEngine;
 import org.apache.shardingsphere.infra.metadata.user.Grantee;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLLoginResult.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLLoginResult.java
index 5f009188ff0..a209a741140 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLLoginResult.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLLoginResult.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 
 /**
  * PostgreSQL login result.
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/exception/PostgreSQLAuthenticationException.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/exception/PostgreSQLAuthenticationException.java
index 514b9463295..fa2bb001371 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/exception/PostgreSQLAuthenticationException.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/exception/PostgreSQLAuthenticationException.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.excep
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import org.apache.shardingsphere.proxy.frontend.exception.FrontendException;
 
 /**
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/generic/PostgreSQLUnsupportedCommandExecutor.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/generic/PostgreSQLUnsupportedCommandExecutor.java
index b6b8b106fee..44cc7330ca0 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/generic/PostgreSQLUnsupportedCommandExecutor.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/generic/PostgreSQLUnsupportedCommandExecutor.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.proxy.frontend.postgresql.command.generic;
 
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLMessageSeverityLevel;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.generic.PostgreSQLErrorResponsePacket;
 import 
org.apache.shardingsphere.proxy.frontend.command.executor.CommandExecutor;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
index e951c42311a..e5a240520fe 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extend
 
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.PostgreSQLPacket;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.PostgreSQLColumnDescription;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.PostgreSQLNoDataPacket;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrPacketFactory.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrPacketFactory.java
index debc37c126d..7738f2fd7bc 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrPacketFactory.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrPacketFactory.java
@@ -20,16 +20,14 @@ package 
org.apache.shardingsphere.proxy.frontend.postgresql.err;
 import com.google.common.base.Strings;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLMessageSeverityLevel;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.generic.PostgreSQLErrorResponsePacket;
-import 
org.apache.shardingsphere.infra.exception.InsertColumnsAndValuesMismatchedException;
-import org.apache.shardingsphere.infra.exception.DBCreateExistsException;
-import org.apache.shardingsphere.infra.exception.InTransactionException;
+import org.apache.shardingsphere.error.mapper.SQLExceptionMapperFactory;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
+import 
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.InvalidAuthorizationSpecificationException;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.PostgreSQLAuthenticationException;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.PostgreSQLProtocolViolationException;
-import 
org.apache.shardingsphere.infra.exception.InvalidParameterValueException;
 import org.postgresql.util.PSQLException;
 import org.postgresql.util.ServerErrorMessage;
 
@@ -51,15 +49,12 @@ public final class PostgreSQLErrPacketFactory {
         if (cause instanceof PSQLException && null != ((PSQLException) 
cause).getServerErrorMessage()) {
             return createErrorResponsePacket(((PSQLException) 
cause).getServerErrorMessage());
         }
-        if (cause instanceof InTransactionException) {
-            return 
PostgreSQLErrorResponsePacket.newBuilder(PostgreSQLMessageSeverityLevel.WARNING,
 PostgreSQLErrorCode.WARNING.getErrorCode(), cause.getMessage()).build();
+        if (cause instanceof ShardingSphereInsideException) {
+            return 
createErrorResponsePacket(SQLExceptionMapperFactory.getInstance("PostgreSQL").convert((ShardingSphereInsideException)
 cause));
         }
         if (cause instanceof SQLException) {
             return createErrorResponsePacket((SQLException) cause);
         }
-        if (cause instanceof InsertColumnsAndValuesMismatchedException) {
-            return 
PostgreSQLErrorResponsePacket.newBuilder(PostgreSQLMessageSeverityLevel.ERROR, 
PostgreSQLErrorCode.SYNTAX_ERROR, cause.getMessage()).build();
-        }
         if (cause instanceof InvalidAuthorizationSpecificationException) {
             return 
PostgreSQLErrorResponsePacket.newBuilder(PostgreSQLMessageSeverityLevel.FATAL, 
PostgreSQLErrorCode.INVALID_AUTHORIZATION_SPECIFICATION, 
cause.getMessage()).build();
         }
@@ -72,15 +67,6 @@ public final class PostgreSQLErrPacketFactory {
         if (cause instanceof PostgreSQLAuthenticationException) {
             return 
PostgreSQLErrorResponsePacket.newBuilder(PostgreSQLMessageSeverityLevel.FATAL, 
((PostgreSQLAuthenticationException) cause).getErrorCode(), 
cause.getMessage()).build();
         }
-        if (cause instanceof InvalidParameterValueException) {
-            InvalidParameterValueException ex = 
(InvalidParameterValueException) cause;
-            String message = String.format("invalid value for parameter 
\"%s\": \"%s\"", ex.getParameterName(), ex.getParameterValue());
-            return 
PostgreSQLErrorResponsePacket.newBuilder(PostgreSQLMessageSeverityLevel.ERROR, 
PostgreSQLErrorCode.INVALID_PARAMETER_VALUE, message).build();
-        }
-        if (cause instanceof DBCreateExistsException) {
-            return 
PostgreSQLErrorResponsePacket.newBuilder(PostgreSQLMessageSeverityLevel.ERROR, 
PostgreSQLErrorCode.DUPLICATE_DATABASE,
-                    
String.format(PostgreSQLErrorCode.DUPLICATE_DATABASE.getConditionName(), 
((DBCreateExistsException) cause).getDatabaseName())).build();
-        }
         // TODO PostgreSQL need consider FrontendConnectionLimitException
         return createErrorResponsePacketForUnknownException(cause);
     }
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
index ff0f078f0f3..e0be621d841 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
@@ -25,7 +25,7 @@ import 
org.apache.shardingsphere.authority.config.AuthorityRuleConfiguration;
 import org.apache.shardingsphere.authority.rule.AuthorityRule;
 import org.apache.shardingsphere.authority.rule.builder.AuthorityRuleBuilder;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLAuthenticationMethod;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLPasswordMessagePacket;
 import 
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
 import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
index 62ff39f22e4..bb544c2073b 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extend
 
 import lombok.SneakyThrows;
 import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
-import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
+import org.apache.shardingsphere.error.postgresql.code.PostgreSQLErrorCode;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.PostgreSQLColumnDescription;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.PostgreSQLNoDataPacket;
 import 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.PostgreSQLParameterDescriptionPacket;
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/exception/SQLParsingException.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/exception/SQLParsingException.java
index c074c273674..bd3fde0ea8a 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/exception/SQLParsingException.java
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/exception/SQLParsingException.java
@@ -17,10 +17,12 @@
 
 package org.apache.shardingsphere.sql.parser.exception;
 
+import 
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
+
 /**
  * Throw exception when SQL parsing error.
  */
-public final class SQLParsingException extends RuntimeException {
+public final class SQLParsingException extends ShardingSphereInsideException {
     
     private static final long serialVersionUID = -6408790652103666096L;
     
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
index beeb66c0692..40110d00822 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.test.integration.engine.ddl;
 import com.google.common.base.Splitter;
 import lombok.SneakyThrows;
 import org.apache.shardingsphere.infra.datanode.DataNode;
-import 
org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException;
+import org.apache.shardingsphere.infra.exception.NoSuchTableException;
 import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
 import 
org.apache.shardingsphere.test.integration.cases.dataset.metadata.DataSetColumn;
 import 
org.apache.shardingsphere.test.integration.cases.dataset.metadata.DataSetIndex;

Reply via email to