hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.05k stars 1.34k forks source link

The Fix For PR #4630 Does Not Work On Oracle ORA-00933 #4636

Open KevinDougan opened 1 year ago

KevinDougan commented 1 year ago

The recent fix that was added into 6.4.3 for #4630 does not work on an Oracle Database.

It produces the following ERROR:

2023-03-09 12:20:35.680 [cdr-scheduler-clustermgr-local-2] ERROR M: R: c.uhn.fhir.jpa.migrate.HapiMigrator - Migration failed
ca.uhn.fhir.jpa.migrate.HapiMigrationException: HAPI-0047: Failure executing task "Execute raw sql", aborting! Cause: ca.uhn.fhir.jpa.migrate.HapiMigrationException: HAPI-0061: Failed during task 6.2.0.20230397.1: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [update BT2_JOB_INSTANCE set UPDATE_TIME = coalesce(end_time, start_time, create_time, TIMESTAMP '2023-01-01 00:00:00') where UPDATE_TIME is null;]; nested exception is java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

I believe this is due to the trailing semi-colons on those added SQL statements, as shown here:

        version.executeRawSql("20230397.1",
            "update BT2_JOB_INSTANCE " +
                "set UPDATE_TIME = coalesce(end_time, start_time, create_time, TIMESTAMP '2023-01-01 00:00:00') " +
                "where UPDATE_TIME is null;");
        version.executeRawSql("20230397.2",
            "update bt2_work_chunk  " +
                "set UPDATE_TIME = coalesce(end_time, start_time, create_time, TIMESTAMP '2023-01-01 00:00:00') " +
                "where UPDATE_TIME is null;");
KevinDougan commented 1 year ago

https://github.com/hapifhir/hapi-fhir/pull/4630/files