Fixes for nightly failures of PG and EDB v12, DB2 10.5 and MariaDB. Exclude Oracle 21 from nightly runs in favor of Atlas build

This commit is contained in:
Christian Beikov 2024-07-16 17:25:57 +02:00
parent b51acb752d
commit 415bfcf8fa
7 changed files with 42 additions and 41 deletions

View File

@ -61,13 +61,18 @@ public class PostgresPlusLegacyDialect extends PostgreSQLLegacyDialect {
functionFactory.sysdate(); functionFactory.sysdate();
functionFactory.systimestamp(); functionFactory.systimestamp();
functionFactory.bitand(); if ( getVersion().isSameOrAfter( 14 ) ) {
functionFactory.bitor(); // Support for these functions were apparently only added in version 14
functionContributions.getFunctionRegistry().patternDescriptorBuilder( "bitxor", "(bitor(?1,?2)-bitand(?1,?2))" ) functionFactory.bitand();
.setExactArgumentCount( 2 ) functionFactory.bitor();
.setArgumentTypeResolver( StandardFunctionArgumentTypeResolvers.ARGUMENT_OR_IMPLIED_RESULT_TYPE ) functionContributions.getFunctionRegistry().patternDescriptorBuilder(
.register(); "bitxor",
"(bitor(?1,?2)-bitand(?1,?2))"
)
.setExactArgumentCount( 2 )
.setArgumentTypeResolver( StandardFunctionArgumentTypeResolvers.ARGUMENT_OR_IMPLIED_RESULT_TYPE )
.register();
}
} }
@Override @Override

View File

@ -61,13 +61,19 @@ public class PostgresPlusDialect extends PostgreSQLDialect {
functionFactory.rownumRowid(); functionFactory.rownumRowid();
functionFactory.sysdate(); functionFactory.sysdate();
functionFactory.systimestamp(); functionFactory.systimestamp();
functionFactory.bitand(); if ( getVersion().isSameOrAfter( 14 ) ) {
functionFactory.bitor(); // Support for these functions were apparently only added in version 14
functionContributions.getFunctionRegistry().patternDescriptorBuilder( "bitxor", "(bitor(?1,?2)-bitand(?1,?2))" ) functionFactory.bitand();
.setExactArgumentCount( 2 ) functionFactory.bitor();
.setArgumentTypeResolver( StandardFunctionArgumentTypeResolvers.ARGUMENT_OR_IMPLIED_RESULT_TYPE ) functionContributions.getFunctionRegistry().patternDescriptorBuilder(
.register(); "bitxor",
"(bitor(?1,?2)-bitand(?1,?2))"
)
.setExactArgumentCount( 2 )
.setArgumentTypeResolver( StandardFunctionArgumentTypeResolvers.ARGUMENT_OR_IMPLIED_RESULT_TYPE )
.register();
}
} }
@Override @Override

View File

@ -87,7 +87,7 @@ public class ArrayTrimTest {
} }
@Test @Test
@SkipForDialect(dialectClass = PostgreSQLDialect.class, majorVersion = 12, reason = "The PostgreSQL emulation for version < 14 doesn't throw an error") @SkipForDialect(dialectClass = PostgreSQLDialect.class, majorVersion = 12, matchSubTypes = true, reason = "The PostgreSQL emulation for version < 14 doesn't throw an error")
@SkipForDialect(dialectClass = CockroachDialect.class, reason = "The Cockroach emulation doesn't throw an error") @SkipForDialect(dialectClass = CockroachDialect.class, reason = "The Cockroach emulation doesn't throw an error")
public void testTrimOutOfRange(SessionFactoryScope scope) { public void testTrimOutOfRange(SessionFactoryScope scope) {
scope.inSession( em -> { scope.inSession( em -> {

View File

@ -206,7 +206,7 @@ public class ManipulationCriteriaTest extends AbstractMetamodelSpecificTest {
@Test @Test
// MySQL does not allow "delete/update from" and subqueries to use the same table // MySQL does not allow "delete/update from" and subqueries to use the same table
@SkipForDialect(dialectClass = MySQLDialect.class) @SkipForDialect(dialectClass = MySQLDialect.class, matchSubTypes = true)
public void testDeleteWithUnCorrelatedSubquery() { public void testDeleteWithUnCorrelatedSubquery() {
CriteriaBuilder builder = entityManagerFactory().getCriteriaBuilder(); CriteriaBuilder builder = entityManagerFactory().getCriteriaBuilder();
EntityManager em = getOrCreateEntityManager(); EntityManager em = getOrCreateEntityManager();

View File

@ -145,11 +145,13 @@ public class GeneratedWritableDelegateTest {
scope.inTransaction( s -> { scope.inTransaction( s -> {
s.createNativeMutationQuery( "create or replace function fun_upper_name() returns trigger as " + TRIGGER ) s.createNativeMutationQuery( "create or replace function fun_upper_name() returns trigger as " + TRIGGER )
.executeUpdate(); .executeUpdate();
s.createNativeMutationQuery( "drop trigger if exists upper_name_1 on values_only" ).executeUpdate();
s.createNativeMutationQuery( "drop trigger if exists upper_name_2 on values_and_identity" ).executeUpdate();
s.createNativeMutationQuery( s.createNativeMutationQuery(
"create or replace trigger upper_name_1 before insert or update on values_only for each row execute procedure fun_upper_name()" "create trigger upper_name_1 before insert or update on values_only for each row execute procedure fun_upper_name()"
).executeUpdate(); ).executeUpdate();
s.createNativeMutationQuery( s.createNativeMutationQuery(
"create or replace trigger upper_name_2 before insert or update on values_and_identity for each row execute procedure fun_upper_name()" "create trigger upper_name_2 before insert or update on values_and_identity for each row execute procedure fun_upper_name()"
).executeUpdate(); ).executeUpdate();
} ); } );
} }

View File

@ -254,7 +254,7 @@ public class DB2StoredProcedureTest {
" SELECT COUNT(*) INTO phoneCount " + " SELECT COUNT(*) INTO phoneCount " +
" FROM phone " + " FROM phone " +
" WHERE person_id = personId; " + " WHERE person_id = personId; " +
"END;" "END"
); );
statement.executeUpdate( statement.executeUpdate(
"CREATE OR REPLACE PROCEDURE sp_person_phones( " + "CREATE OR REPLACE PROCEDURE sp_person_phones( " +
@ -266,7 +266,7 @@ public class DB2StoredProcedureTest {
" FROM phone " + " FROM phone " +
" WHERE person_id = personId; " + " WHERE person_id = personId; " +
" OPEN personPhones; " + " OPEN personPhones; " +
"END;" "END"
); );
statement.executeUpdate( statement.executeUpdate(
"CREATE OR REPLACE FUNCTION fn_count_phones( " + "CREATE OR REPLACE FUNCTION fn_count_phones( " +
@ -278,7 +278,7 @@ public class DB2StoredProcedureTest {
" FROM phone " + " FROM phone " +
" WHERE person_id = personId; " + " WHERE person_id = personId; " +
" RETURN phoneCount; " + " RETURN phoneCount; " +
"END;" "END"
); );
statement.executeUpdate( statement.executeUpdate(
"CREATE OR REPLACE FUNCTION fn_person_and_phones(personId INTEGER) " + "CREATE OR REPLACE FUNCTION fn_person_and_phones(personId INTEGER) " +
@ -293,7 +293,7 @@ public class DB2StoredProcedureTest {
" \"ph.id\" BIGINT, " + " \"ph.id\" BIGINT, " +
" \"ph.person_id\" BIGINT, " + " \"ph.person_id\" BIGINT, " +
" \"ph.phone_number\" VARCHAR(255), " + " \"ph.phone_number\" VARCHAR(255), " +
" \"ph.valid\" BOOLEAN " + " \"ph.valid\" SMALLINT " +
" ) " + " ) " +
" BEGIN ATOMIC " + " BEGIN ATOMIC " +
" RETURN SELECT pr.id AS \"pr.id\", " + " RETURN SELECT pr.id AS \"pr.id\", " +
@ -309,7 +309,7 @@ public class DB2StoredProcedureTest {
" FROM person pr " + " FROM person pr " +
" JOIN phone ph ON pr.id = ph.person_id " + " JOIN phone ph ON pr.id = ph.person_id " +
" WHERE pr.id = personId; " + " WHERE pr.id = personId; " +
" END; " ); " END " );
statement.executeUpdate( statement.executeUpdate(
"CREATE OR REPLACE " + "CREATE OR REPLACE " +
"PROCEDURE singleRefCursor(OUT p_recordset CURSOR) " + "PROCEDURE singleRefCursor(OUT p_recordset CURSOR) " +
@ -318,7 +318,7 @@ public class DB2StoredProcedureTest {
" SELECT 1 as id " + " SELECT 1 as id " +
" FROM sysibm.dual; " + " FROM sysibm.dual; " +
" OPEN p_recordset; " + " OPEN p_recordset; " +
" END; " " END "
); );
statement.executeUpdate( statement.executeUpdate(
"CREATE OR REPLACE " + "CREATE OR REPLACE " +
@ -329,11 +329,11 @@ public class DB2StoredProcedureTest {
" FROM sysibm.dual; " + " FROM sysibm.dual; " +
" SELECT 1 INTO p_value FROM sysibm.dual; " + " SELECT 1 INTO p_value FROM sysibm.dual; " +
" OPEN p_recordset; " + " OPEN p_recordset; " +
" END; " " END"
); );
statement.executeUpdate( statement.executeUpdate(
"CREATE OR REPLACE PROCEDURE sp_phone_validity ( " + "CREATE OR REPLACE PROCEDURE sp_phone_validity ( " +
" IN validity BOOLEAN, " + " IN validity SMALLINT, " +
" OUT personPhones CURSOR ) " + " OUT personPhones CURSOR ) " +
"BEGIN " + "BEGIN " +
" SET personPhones = CURSOR FOR " + " SET personPhones = CURSOR FOR " +
@ -341,11 +341,11 @@ public class DB2StoredProcedureTest {
" FROM phone " + " FROM phone " +
" WHERE valid = validity; " + " WHERE valid = validity; " +
" OPEN personPhones; " + " OPEN personPhones; " +
"END;" "END"
); );
statement.executeUpdate( statement.executeUpdate(
"CREATE OR REPLACE PROCEDURE sp_votes ( " + "CREATE OR REPLACE PROCEDURE sp_votes ( " +
" IN validity BOOLEAN, " + " IN validity CHAR(1), " +
" OUT votes CURSOR ) " + " OUT votes CURSOR ) " +
"BEGIN " + "BEGIN " +
" SET votes = CURSOR FOR " + " SET votes = CURSOR FOR " +
@ -353,13 +353,9 @@ public class DB2StoredProcedureTest {
" FROM vote " + " FROM vote " +
" WHERE vote_choice = validity; " + " WHERE vote_choice = validity; " +
" OPEN votes; " + " OPEN votes; " +
"END;" "END"
); );
} }
catch (final SQLException e) {
System.err.println( "Error exporting procedure and function definitions to DB2 database : " + e.getMessage() );
e.printStackTrace( System.err );
}
} ) ); } ) );
scope.inTransaction( (entityManager) -> { scope.inTransaction( (entityManager) -> {

View File

@ -32,7 +32,6 @@ stage('Configure') {
new BuildEnvironment( dbName: 'mariadb_10_4' ), new BuildEnvironment( dbName: 'mariadb_10_4' ),
new BuildEnvironment( dbName: 'postgresql_12' ), new BuildEnvironment( dbName: 'postgresql_12' ),
new BuildEnvironment( dbName: 'edb_12' ), new BuildEnvironment( dbName: 'edb_12' ),
new BuildEnvironment( dbName: 'oracle_21' ), // Did not find an image for Oracle-XE 19c
new BuildEnvironment( dbName: 'db2_10_5', longRunning: true ), new BuildEnvironment( dbName: 'db2_10_5', longRunning: true ),
new BuildEnvironment( dbName: 'mssql_2017' ), // Unfortunately there is no SQL Server 2008 image, so we have to test with 2017 new BuildEnvironment( dbName: 'mssql_2017' ), // Unfortunately there is no SQL Server 2008 image, so we have to test with 2017
// new BuildEnvironment( dbName: 'sybase_16' ), // There only is a Sybase ASE 16 image, so no pint in testing that nightly // new BuildEnvironment( dbName: 'sybase_16' ), // There only is a Sybase ASE 16 image, so no pint in testing that nightly
@ -137,13 +136,6 @@ stage('Build') {
sh "./docker_db.sh edb_12" sh "./docker_db.sh edb_12"
state[buildEnv.tag]['containerName'] = "edb" state[buildEnv.tag]['containerName'] = "edb"
break; break;
case "oracle_21":
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
docker.image('gvenzl/oracle-xe:21.3.0').pull()
}
sh "./docker_db.sh oracle_21"
state[buildEnv.tag]['containerName'] = "oracle"
break;
case "db2_10_5": case "db2_10_5":
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') { docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
docker.image('ibmoms/db2express-c@sha256:a499afd9709a1f69fb41703e88def9869955234c3525547e2efc3418d1f4ca2b').pull() docker.image('ibmoms/db2express-c@sha256:a499afd9709a1f69fb41703e88def9869955234c3525547e2efc3418d1f4ca2b').pull()