From 4a1bdda2aee8becaeacf1dc7f26a513cb9712e19 Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 9 Apr 2026 15:05:04 +0300 Subject: [PATCH] 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. --- whatsapp-bridge/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/whatsapp-bridge/main.go b/whatsapp-bridge/main.go index 961f72f..6337870 100644 --- a/whatsapp-bridge/main.go +++ b/whatsapp-bridge/main.go @@ -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...)