Fix PostgreSQL parameter type error in ListChats

- Added ::int type casting to LIMIT and OFFSET parameters for PostgreSQL
- Fixed parameter numbering: changed placeholder(len(args)+2) to placeholder(len(args)+1) for OFFSET clause
- Resolves error: pq: could not determine data type of parameter  (42P18)

This fix ensures proper parameter binding when using PostgreSQL with the
whatsapp-bridge ListChats endpoint, which is used by the MCP server
to retrieve WhatsApp chat lists.
This commit is contained in:
Mike
2026-04-09 15:05:04 +03:00
parent f10176ffa7
commit 4a1bdda2ae
+2 -2
View File
@@ -2019,10 +2019,10 @@ func (store *MessageStore) ListChats(
}
q += " ORDER BY " + order
q += " LIMIT " + placeholder(len(args)+1)
q += " LIMIT " + placeholder(len(args)+1) + "::int"
args = append(args, limit)
q += " OFFSET " + placeholder(len(args)+2)
q += " OFFSET " + placeholder(len(args)+1) + "::int"
args = append(args, page*limit)
rows, err := store.db.Query(q, args...)