View Revisions: Issue #5593

Summary 0005593: Incorrect Logic in various DDLBuilders for Processing Changes
Revision 2023-01-25 15:56 by cquamme
Description In the DDLBuilders for Firebird, Oracle, Postgres, and Tibero, there is some incorrect logic when determining processing of changes that occur in the database, that results in attempting to allow primary keys to be made null, which results in a SQL error in the log.

2023-01-25 10:54:58,083 INFO [client-pg] [PostgreSql95DatabasePlatform] [client-pg-dataloader-7] Running alter sql:
ALTER TABLE "public"."customer"
     ALTER COLUMN "_id" DROP NOT NULL ;

2023-01-25 10:54:58,085 WARN [client-pg] [JdbcSqlTemplate] [client-pg-dataloader-7] ERROR: column "_id" is in a primary key. Failed to execute: ALTER TABLE "public"."customer"
     ALTER COLUMN "_id" DROP NOT NULL
2023-01-25 10:54:58,109 ERROR [client-pg] [ManageIncomingBatchListener] [client-pg-dataloader-7] Failed to load batch mngo-30 org.jumpmind.db.sql.SqlException: ERROR: column "_id" is in a primary key
    at org.jumpmind.db.sql.AbstractSqlTemplate.translate(AbstractSqlTemplate.java:308)
    at org.jumpmind.db.sql.AbstractSqlTemplate.translate(AbstractSqlTemplate.java:297)
    at org.jumpmind.db.sql.JdbcSqlTemplate.execute(JdbcSqlTemplate.java:494)
    at org.jumpmind.db.sql.JdbcSqlTemplate.update(JdbcSqlTemplate.java:405)
    at org.jumpmind.db.sql.SqlScript.execute(SqlScript.java:108)
    at org.jumpmind.db.platform.AbstractDatabasePlatform.alterTables(AbstractDatabasePlatform.java:253)
    at org.jumpmind.db.platform.AbstractDatabasePlatform.alterDatabase(AbstractDatabasePlatform.java:221)
    at org.jumpmind.symmetric.io.data.writer.DefaultDatabaseWriter.create(DefaultDatabaseWriter.java:630)
    at org.jumpmind.symmetric.io.data.writer.DefaultDatabaseWriter.create(DefaultDatabaseWriter.java:640)
    at org.jumpmind.symmetric.io.data.writer.DefaultDatabaseWriter.create(DefaultDatabaseWriter.java:605)
    at org.jumpmind.symmetric.io.data.writer.AbstractDatabaseWriter.write(AbstractDatabaseWriter.java:197)
    at org.jumpmind.symmetric.io.data.writer.NestedDataWriter.write(NestedDataWriter.java:62)
    at org.jumpmind.symmetric.model.ProcessInfoDataWriter.write(ProcessInfoDataWriter.java:84)
    at org.jumpmind.symmetric.io.data.writer.NestedDataWriter.write(NestedDataWriter.java:62)
    at org.jumpmind.symmetric.io.data.writer.TransformWriter.write(TransformWriter.java:186)
    at org.jumpmind.symmetric.io.data.DataProcessor.forEachDataInTable(DataProcessor.java:194)
    at org.jumpmind.symmetric.io.data.DataProcessor.forEachTableInBatch(DataProcessor.java:160)
    at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:108)
    at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2.call(DataLoaderService.java:1046)
    at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2.call(DataLoaderService.java:1)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:750)
Caused by: org.postgresql.util.PSQLException: ERROR: column "_id" is in a primary key
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:496)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:413)
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:333)
    at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:319)
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:295)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:290)
    at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:193)
    at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:193)
    at org.jumpmind.db.sql.JdbcSqlTemplate$6.execute(JdbcSqlTemplate.java:420)
    at org.jumpmind.db.sql.JdbcSqlTemplate$6.execute(JdbcSqlTemplate.java:1)
    at org.jumpmind.db.sql.JdbcSqlTemplate.execute(JdbcSqlTemplate.java:492)
    ... 21 more
Revision 2022-11-21 18:04 by cquamme
Description In the DDLBuilders for Firebird, Oracle, Postgres, and Tibero, there is some incorrect logic when determining processing of changes that occur in the database, that results in attempting to allow primary keys to be made null, which results in a SQL error in the log.