Skip to content

fix: Postgres export_graph ignores pagination and filters #2271

Description

@Kwizii

Bug Description

When GRAPH_DB_BACKEND=postgres, PostgresGraphDB.export_graph accepted page, page_size, memory_type, status, and filter only through **kwargs but silently ignored them. Its SQL had no LIMIT/OFFSET and no filtering beyond user_name, and total_nodes was set to the length of the returned page.

As a result, every consumer of POST /get_memory (which passes pagination and tag filters down to text_mem.get_allexport_graph) received the full memory list on every page, with an incorrect total — pagination and tag filtering were both broken.

How to Reproduce

  1. Run MemOS Product API with GRAPH_DB_BACKEND=postgres.
  2. Call POST /product/get_memory with page, page_size, and/or tag filters.
  3. Observe that all memories are returned regardless of page, and total_nodes matches the page size instead of the filtered total.

Environment

  • Python: 3.11
  • Operating System: Linux (Docker)
  • MemOS: main branch
  • Graph backend: postgres + pgvector

Additional Context

Metadata

Metadata

Labels

ai:taskDispatched to AI coding agent | 已派发给 AI 编码任务ai:testingAI agent is running tests | AI 正在运行测试area:databasegraph_db + vector_db | 图数据库与向量数据库status:in-progressSomeone or AI is working on it | 人工或 AI 正在处理types:bugSomething isn't working | 功能异常

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions