Message: Failed to query SQL statement. Reason: ERROR: syntax error at or near "AND" LINE 26: WHERE a.id = AND a.adate < CURRENT_TIMESTAMP ^