This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 92df26bd9b8 Fix swapped names in PostgreSQL undefined column error
message (#39125)
92df26bd9b8 is described below
commit 92df26bd9b82f1ec454ec9545eb3d101747bb7f6
Author: Eunbin Son <[email protected]>
AuthorDate: Tue Jul 28 13:09:37 2026 +0900
Fix swapped names in PostgreSQL undefined column error message (#39125)
Co-authored-by: Liang Zhang <[email protected]>
---
.../postgresql/mapper/PostgreSQLDialectExceptionMapper.java | 2 +-
.../postgresql/mapper/PostgreSQLDialectExceptionMapperTest.java | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git
a/database/exception/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/exception/postgresql/mapper/PostgreSQLDialectExceptionMapper.java
b/database/exception/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/exception/postgresql/mapper/PostgreSQLDialectExceptionMapper.java
index 5e736a246bd..b274c0594c1 100644
---
a/database/exception/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/exception/postgresql/mapper/PostgreSQLDialectExceptionMapper.java
+++
b/database/exception/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/exception/postgresql/mapper/PostgreSQLDialectExceptionMapper.java
@@ -97,7 +97,7 @@ public final class PostgreSQLDialectExceptionMapper
implements SQLDialectExcepti
}
if (sqlDialectException instanceof ColumnNotFoundException) {
ColumnNotFoundException cause = (ColumnNotFoundException)
sqlDialectException;
- return new PostgreSQLException(new
ServerErrorMessage(FATAL_SEVERITY, PostgreSQLVendorError.UNDEFINED_COLUMN,
cause.getTableName(), cause.getColumnName()));
+ return new PostgreSQLException(new
ServerErrorMessage(FATAL_SEVERITY, PostgreSQLVendorError.UNDEFINED_COLUMN,
cause.getColumnName(), cause.getTableName()));
}
return new PostgreSQLException(sqlDialectException.getMessage(),
PostgreSQLState.UNEXPECTED_ERROR.getValue());
}
diff --git
a/database/exception/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/exception/postgresql/mapper/PostgreSQLDialectExceptionMapperTest.java
b/database/exception/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/exception/postgresql/mapper/PostgreSQLDialectExceptionMapperTest.java
index ff85f3445c6..36628af1214 100644
---
a/database/exception/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/exception/postgresql/mapper/PostgreSQLDialectExceptionMapperTest.java
+++
b/database/exception/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/exception/postgresql/mapper/PostgreSQLDialectExceptionMapperTest.java
@@ -80,6 +80,15 @@ class PostgreSQLDialectExceptionMapperTest {
assertNull(actual.getServerErrorMessage());
}
+ @Test
+ void assertConvertColumnNotFoundMessage() {
+ ColumnNotFoundException sqlDialectException =
mock(ColumnNotFoundException.class);
+ when(sqlDialectException.getTableName()).thenReturn("t_order");
+ when(sqlDialectException.getColumnName()).thenReturn("user_id");
+ PostgreSQLException actual = (PostgreSQLException)
mapper.convert(sqlDialectException);
+ assertThat(actual.getServerErrorMessage().getMessage(), is("Column
\"user_id\" of table \"t_order\" does not exist"));
+ }
+
private static Stream<Arguments> convertArguments() {
return Stream.of(
Arguments.of("unknown_database",
UnknownDatabaseException.class, PostgreSQLVendorError.INVALID_CATALOG_NAME,
"FATAL"),