forked from cardosofelipe/fast-next-template
fix(mcp-kb): SQL HAVING clause without GROUP BY breaks semantic search #73
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug Description
In
mcp-servers/knowledge-base/database.py, the_format_where_clausemethod usesHAVINGwithout aGROUP BYclause, which breaks PostgreSQL queries when semantic search is combined with filters.Location
mcp-servers/knowledge-base/database.py:393-395Expected Behavior
The query should properly filter by minimum similarity score without breaking PostgreSQL syntax.
Actual Behavior
Queries with
min_scoreparameter will fail with PostgreSQL syntax errors.Fix Required
Either:
GROUP BYclause when usingHAVINGWHEREwith proper vector distance calculationRelated
cardosofelipe referenced this issue2026-01-04 00:50:16 +00:00