From 7c6d30f4c83c50157c348b1f0a95fba8b1398b91 Mon Sep 17 00:00:00 2001 From: buua436 <66937541+buua436@users.noreply.github.com> Date: Thu, 20 Nov 2025 12:49:13 +0800 Subject: [PATCH] Fix:RagFlow not starting with Postgres DB (#11398) ### What problem does this PR solve? issue: #11293 change: RagFlow not starting with Postgres DB ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/db/services/connector_service.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api/db/services/connector_service.py b/api/db/services/connector_service.py index 23e9faffe..db8c713e2 100644 --- a/api/db/services/connector_service.py +++ b/api/db/services/connector_service.py @@ -15,6 +15,7 @@ # import logging from datetime import datetime +import os from typing import Tuple, List from anthropic import BaseModel @@ -103,7 +104,8 @@ class SyncLogsService(CommonService): Knowledgebase.avatar.alias("kb_avatar"), Connector2Kb.auto_parse, cls.model.from_beginning.alias("reindex"), - cls.model.status + cls.model.status, + cls.model.update_time ] if not connector_id: fields.append(Connector.config) @@ -116,7 +118,11 @@ class SyncLogsService(CommonService): if connector_id: query = query.where(cls.model.connector_id == connector_id) else: - interval_expr = SQL("INTERVAL `t2`.`refresh_freq` MINUTE") + database_type = os.getenv("DB_TYPE", "mysql") + if "postgres" in database_type.lower(): + interval_expr = SQL("make_interval(mins => t2.refresh_freq)") + else: + interval_expr = SQL("INTERVAL `t2`.`refresh_freq` MINUTE") query = query.where( Connector.input_type == InputType.POLL, Connector.status == TaskStatus.SCHEDULE,