From f91905c34a59529020c6c93b0452056fa3c1bfee Mon Sep 17 00:00:00 2001 From: Gavin Date: Fri, 2 Dec 2022 21:47:07 +0100 Subject: [PATCH] unquote table/column names when inferring sequence name on postgres --- .../dialect/identity/PostgreSQLIdentityColumnSupport.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/identity/PostgreSQLIdentityColumnSupport.java b/hibernate-core/src/main/java/org/hibernate/dialect/identity/PostgreSQLIdentityColumnSupport.java index 0b8cdf84d6..874f0eca70 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/identity/PostgreSQLIdentityColumnSupport.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/identity/PostgreSQLIdentityColumnSupport.java @@ -10,6 +10,8 @@ import org.hibernate.MappingException; import java.sql.Types; +import static org.hibernate.internal.util.StringHelper.unquote; + /** * @author Andrea Boriero */ @@ -21,7 +23,7 @@ public class PostgreSQLIdentityColumnSupport extends IdentityColumnSupportImpl { @Override public String getIdentitySelectString(String table, String column, int type) { - return "select currval('" + table + '_' + column + "_seq')"; + return "select currval('" + unquote(table) + '_' + unquote(column) + "_seq')"; } @Override