HHH-17303 Fix test on PostgreSQL

This commit is contained in:
Christian Beikov 2023-12-20 14:41:51 +01:00
parent 3c3aead17b
commit ad283cdc4c
2 changed files with 3 additions and 2 deletions

View File

@ -42,6 +42,7 @@ import org.hibernate.dialect.sequence.PostgreSQLSequenceSupport;
import org.hibernate.dialect.sequence.SequenceSupport; import org.hibernate.dialect.sequence.SequenceSupport;
import org.hibernate.dialect.unique.CreateTableUniqueDelegate; import org.hibernate.dialect.unique.CreateTableUniqueDelegate;
import org.hibernate.dialect.unique.UniqueDelegate; import org.hibernate.dialect.unique.UniqueDelegate;
import org.hibernate.engine.jdbc.Size;
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo; import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy; import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper; import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
@ -829,7 +830,7 @@ public class PostgreSQLLegacyDialect extends Dialect {
@Override @Override
public String getSelectClauseNullString(int sqlType, TypeConfiguration typeConfiguration) { public String getSelectClauseNullString(int sqlType, TypeConfiguration typeConfiguration) {
// Workaround for postgres bug #1453 // Workaround for postgres bug #1453
return "null::" + typeConfiguration.getDdlTypeRegistry().getDescriptor( sqlType ).getRawTypeName(); return "cast(null as " + typeConfiguration.getDdlTypeRegistry().getDescriptor( sqlType ).getRawTypeName() + ")";
} }
@Override @Override

View File

@ -883,7 +883,7 @@ public class PostgreSQLDialect extends Dialect {
public String getSelectClauseNullString(int sqlType, TypeConfiguration typeConfiguration) { public String getSelectClauseNullString(int sqlType, TypeConfiguration typeConfiguration) {
// TODO: adapt this to handle named enum types! // TODO: adapt this to handle named enum types!
// Workaround for postgres bug #1453 // Workaround for postgres bug #1453
return "null::" + typeConfiguration.getDdlTypeRegistry().getDescriptor( sqlType ).getRawTypeName(); return "cast(null as " + typeConfiguration.getDdlTypeRegistry().getDescriptor( sqlType ).getRawTypeName() + ")";
} }
@Override @Override