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:
@@ -2019,10 +2019,10 @@ func (store *MessageStore) ListChats(
|
|||||||
}
|
}
|
||||||
q += " ORDER BY " + order
|
q += " ORDER BY " + order
|
||||||
|
|
||||||
q += " LIMIT " + placeholder(len(args)+1)
|
q += " LIMIT " + placeholder(len(args)+1) + "::int"
|
||||||
args = append(args, limit)
|
args = append(args, limit)
|
||||||
|
|
||||||
q += " OFFSET " + placeholder(len(args)+2)
|
q += " OFFSET " + placeholder(len(args)+1) + "::int"
|
||||||
args = append(args, page*limit)
|
args = append(args, page*limit)
|
||||||
|
|
||||||
rows, err := store.db.Query(q, args...)
|
rows, err := store.db.Query(q, args...)
|
||||||
|
|||||||
Reference in New Issue
Block a user