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>
This commit is contained in:
Elrond
2026-10-06 23:00:38 -04:00
parent 6bb471e048
commit 63e051871b

View File

@@ -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
)