Hi, My name is hansu chung.
One of my clients asked me that some auto-generated SQL query for Postgre is not working. It is just hanged.
But It the query for MSSQL is working well.
There is only one different structure between Postgre and MSSQL.
I have 3 files. A.text is automatically generated SQL, B.text is manually modified sql and C.text is auto-generated query for MSSQL.
We firstly execute the “AS WITH primary_events” in the create qualified events then execute the “create primary_events”.
CREATE TABLE primary_events (event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id) AS ( -- Begin Primary Events select P.ordinal as event_id, P.person_id, P.start_date, P.end_date, op_start_date, op_end_date, cast(P.visit_occurrence_id as bigint) as visit_occurrence_id FROM ( select E.person_id, E.start_date, E.end_date, row_number() OVER (PARTITION BY E.person_id ORDER BY E.sort_date ASC) ordinal, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date, cast(E.visit_occurrence_id as bigint) as visit_occurrence_id FROM ( -- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, (C.condition_start_date + 1*INTERVAL'1 day')) as end_date, C.CONDITION_CONCEPT_ID as TARGET_CONCEPT_ID, C.visit_occurrence_id, C.condition_start_date as sort_date FROM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We cannot change auto-generated sql query manually whenever it is not working properly. I would like to ask an Atlas manager to change the auto-generated option of the Postgre DB. Could you please check the auto-generated process of Postgre DB? Sincerely, Hansu Chung