While performing metadata sync from one instance(2.40.4.1) to another(2.40.4.1), I am receiving below error
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SELECT count(instance) FROM ( SELECT TEI.uid AS instance, TEI.created AS created, TEI.lastupdated AS lastupdated, TEI.ou AS ou, TEI.ouname AS ouname, TET.uid AS te, TEI.inactive AS inactive, TEI.potentialduplicate AS potentialduplicate, TEI.deleted AS deleted FROM (SELECT DISTINCT TEI.trackedentityinstanceid, TEI.uid, TEI.created, TEI.lastupdated, TEI.inactive, TEI.trackedentitytypeid, TEI.potentialduplicate, TEI.deleted, OU.uid as ou, OU.name as ouname FROM trackedentityinstance TEI INNER JOIN program P ON P.trackedentitytypeid = TEI.trackedentitytypeid AND P.programid IN ()LEFT JOIN trackedentityprogramowner PO ON PO.trackedentityinstanceid = TEI.trackedentityinstanceid AND P.programid = PO.programid INNER JOIN organisationunit OU ON OU.organisationunitid = COALESCE(PO.organisationunitid, TEI.organisationunitid) where TEI.trackedentitytypeid in (215088) and TEI.lastupdated >= TEI.lastsynchronized AND TEI.lastupdated >= ‘1970-01-01T01:00:00.000’) TEI LEFT JOIN trackedentitytype TET ON TET.trackedentitytypeid = TEI.trackedentitytypeid ) teicount]; nested exception is org.postgresql.util.PSQLException: ERROR: syntax error at or near “)”
I could see data in Program and Tracked Entities table so I dont see a point of having P.programid IN (). Should there be something else I should also be looking at.
Thank you for the details you shared, and welcome to the community!
So based on your explanation, when you create a Tracker Program in addition to everything else that was already in the system, the sync works? What happens now if you delete this program, does the error return?
Hi @Vishwanideep_Kumar
I would like more details to be able to reproduce this
Does the remote server have both Tracker and Event programs or just Event programs? I understand that the local server has only Event Programs. Correct?