From 5da7b22734e0950418b107c333cdfabad765a122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= Date: Thu, 14 Dec 2023 08:44:50 +0100 Subject: [PATCH] fix(store): properly generate IN clause for stored queries --- waku/waku_archive/driver/postgres_driver/postgres_driver.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/waku/waku_archive/driver/postgres_driver/postgres_driver.nim b/waku/waku_archive/driver/postgres_driver/postgres_driver.nim index 351ed1a2b..d156452b1 100644 --- a/waku/waku_archive/driver/postgres_driver/postgres_driver.nim +++ b/waku/waku_archive/driver/postgres_driver/postgres_driver.nim @@ -317,6 +317,9 @@ proc getMessagesPreparedStmt(s: PostgresDriver, ## prepared statements. ## ## contentTopic - string with list of conten topics. e.g: "'ctopic1','ctopic2','ctopic3'" + ## + + warn "Conntent topics joined", topic=contentTopic var rows: seq[(PubsubTopic, WakuMessage, seq[byte], Timestamp)] proc rowCallback(pqResult: ptr PGresult) = @@ -394,7 +397,7 @@ method getMessages*(s: PostgresDriver, endTime.isSome(): ## Considered the most common query. Therefore, we use prepared statements to optimize it. - return await s.getMessagesPreparedStmt(contentTopicSeq.join(","), + return await s.getMessagesPreparedStmt("'" & contentTopicSeq.join("','") & "'", PubsubTopic(pubsubTopic.get()), cursor, startTime.get(),