From 63e051871b84fd1361d0e963af9dc7469b4e5b33 Mon Sep 17 00:00:00 2001 From: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Date: Tue, 6 Oct 2026 23:00:38 -0400 Subject: [PATCH] fix(buzz-db): parenthesize ->> before COLLATE in NIP-43 drift query COLLATE binds tighter than ->>, so `tag->>2 COLLATE "C"` parsed as `tag ->> (2 COLLATE "C")` and Postgres rejected the whole query with "collations are not supported by type integer". Every reconcile pass failed and no kind:13534 snapshot was ever repaired. Found by live E2E on Postgres 17. Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> --- crates/buzz-db/src/store/relay_members.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/buzz-db/src/store/relay_members.rs b/crates/buzz-db/src/store/relay_members.rs index 37a5c5f6a1..93b270efc9 100644 --- a/crates/buzz-db/src/store/relay_members.rs +++ b/crates/buzz-db/src/store/relay_members.rs @@ -183,7 +183,7 @@ async fn nip43_membership_snapshot_drift( SELECT COALESCE( jsonb_agg( jsonb_build_array(lower(tag->>1), tag->>2) - ORDER BY lower(tag->>1) COLLATE "C", tag->>2 COLLATE "C" + ORDER BY lower(tag->>1) COLLATE "C", (tag->>2) COLLATE "C" ), '[]'::jsonb )