1 Commits
Author SHA1 Message Date
hieunm-aisa a0b9d4272c fix(vault): deduplicate wikilinks before batch INSERT to prevent SQLSTATE 21000 (#1565)
When a document contains multiple [[target]] wikilinks pointing to the same
destination, SyncDocLinks produced duplicate (FromDocID, ToDocID, LinkType)
entries. The batch INSERT ... ON CONFLICT DO UPDATE in CreateLinks then failed
because PostgreSQL rejects a single statement updating the same row twice.

Deduplicate by (FromDocID, ToDocID, LinkType) in SyncDocLinks before calling
CreateLinks, concatenating contexts with " | " separator so no surrounding
text is lost.

Fixes #1473

(cherry picked from commit 549c81fd2406875be34cec3d7274125238e7d4a0)
2026-09-26 10:25:37 +08:00