View Issue Details

IDProjectCategoryView StatusLast Update
0005670SymmetricDS ProBugpublic2023-01-31 16:22
Reportercquamme Assigned Tocquamme  
Prioritynormal 
Status closedResolutionfixed 
Product Version3.14.4 
Target Version3.14.5Fixed in Version3.14.5 
Summary0005670: Incorrect logic in MongoDB DDL Reader causes alter SQL to try and drop primary key
DescriptionIn the DDL Reader for MongoDB there is some incorrect logic when setting columns that results in attempting to allow primary keys to be made null by the alter SQL, 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
Steps To Reproduce1. Setup MongoDB as a server node.
2. Set up Postgres as a client node.
3. Setup customer table on Mongo node.
4. Configure table to run bidirectionally
5. Run an initial load with a create table.
6. Error will show up in log and initial load will error.
TagsNo tags attached.

Relationships

related to 0005593 closedcquamme SymmetricDS Incorrect Logic in various DDLBuilders for Processing Changes 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2023-01-30 13:36 cquamme New Issue
2023-01-30 13:36 cquamme Status new => assigned
2023-01-30 13:36 cquamme Assigned To => cquamme
2023-01-30 13:48 cquamme Status assigned => resolved
2023-01-30 13:48 cquamme Relationship added related to 0005593
2023-01-31 16:22 elong Fixed in Version => 3.14.5
2023-02-15 20:26 admin Status resolved => closed