mdnncz commented on issue #61390:
URL: https://github.com/apache/airflow/issues/61390#issuecomment-3841547235

   Found the logical issue after using `AIRFLOW__LOGGING__LOGGING_LEVEL=DEBUG` 
and seing queries issued against the db.
   The "old rows query" is invalid for the `dag_version` table.
   It has only simple `WHERE base.created_at < :created_at_1` condition. But 
you can't delete version, which has task_intances (started after the version 
has been created obviously).
   
   IMHO the query should be:
   ```
   SELECT base.*
   FROM dag_version as base
   WHERE base.created_at < :created_at_1
   AND base.id NOT IN (SELECT DISTINCT dag_version_id FROM task_instance)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to