View Issue Details

IDProjectCategoryView StatusLast Update
0000138SymmetricDSBugpublic2009-01-16 11:48
ReporterAssigned Tochenson  
Priorityhigh 
Status closedResolutionfixed 
Product Version1.7.3 
Summary0000138: Target Schema is not taken into account while purging data when 'initial.load.delete.first' is set to true
Description"With 'initial.load.delete.first' set to true on the server, when a reload is raised for the client, following log is seen on the console: ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2009-08-27 05:17:28,550 ERROR [org.jumpmind.symmetric.service.impl.DataLoaderService] [pulljob] Failed to load batch 001-5 org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [delete from pem_module]; nested exception is org.postgresql.util.PSQLException: ERROR: relation ""pem_module"" does not exist at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:97) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:407) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:429) at org.jumpmind.symmetric.load.csv.CsvLoader.runSql(CsvLoader.java:387) at org.jumpmind.symmetric.load.csv.CsvLoader.load(CsvLoader.java:162) at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy12.load(Unknown Source) at org.jumpmind.symmetric.service.impl.DataLoaderService$TransactionalLoadDelegate.doInTransaction(DataLoaderService.java:493) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128) at org.jumpmind.symmetric.service.impl.DataLoaderService.loadBatch(DataLoaderService.java:462) at org.jumpmind.symmetric.service.impl.DataLoaderService.loadDataAndReturnBatches(DataLoaderService.java:208) at org.jumpmind.symmetric.service.impl.DataLoaderService.loadData(DataLoaderService.java:107) at org.jumpmind.symmetric.service.impl.PullService.pullData(PullService.java:69) at org.jumpmind.symmetric.job.PullJob.doJob(PullJob.java:38) at org.jumpmind.symmetric.job.AbstractJob.run(AbstractJob.java:83) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) Caused by: org.postgresql.util.PSQLException: ERROR: relation ""pem_module"" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:329) at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:261) at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:422) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:396) ... 23 more ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ On looking into the code, the org.jumpmind.symmetric.db.SqlTemplate has the method: ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ public String createPurgeSql(Node node, IDbDialect dialect, Trigger trig, TriggerHistory hist) { // TODO: during reload, purge table using initial_load_select clause String sql = ""delete from "" + getDefaultTargetTableName(trig, hist); // + "" where "" + trig.getInitialLoadSelect(); // sql = replace(""groupId"", node.getNodeGroupId(), sql); // sql = replace(""externalId"", node.getExternalId(), sql); return sql; } ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ This does not use the target-schema information from the trigger. The ""getDefaultTargetTableName"" method should be modified to return the fully qualified table name as <schema-name>.<table-name>. Note: There are presumably many other places where target-schema need to be considered. Kindly have a dedicated cycle to look into all areas that requires the target-schema in the equation."
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change