org-roam / org-roam-ui

A graphical frontend for exploring your org-roam Zettelkasten
GNU General Public License v3.0
1.99k stars 109 forks source link

[BUG] EmacSQL had an unhandled condition: no such column #292

Open dotinspace opened 1 year ago

dotinspace commented 1 year ago

Describe the bug When activating org-roam-ui-mode, I encounter an error in emacs:

Error (websocket): in callback `on-open': 
EmacSQL had an unhandled condition: 
nil, nil, nil, ("SQL logic error" "no such column: \\," 1 1)

To Reproduce Which specific things did you do which lead to said bug? E.g. what did you click, which commands did you call, etc.

  1. org-roam-db-sync
  2. org-roam-ui-mode

Expected behavior No error displayed in emacs, and my org-roam nodes displayed in web ui.

What browser were you using? Firefox

Additional context

When trying to debug the issue, I found that the following query appears to be the culprit, or at least it produces the same error on my system: https://github.com/org-roam/org-roam-ui/blob/6f783297f37e95d083b32a7160afcb55e309e883/org-roam-ui.el#L467-L483

"SELECT id, file, title, level, pos, olp, properties, group_concat(tag, \"\\,\") AS tags 
FROM nodes 
LEFT JOIN tags ON id = node_id 
GROUP BY id;"

Specifically, group_concat(tag, \"\\,\") produces the error. However, the following query works in emacs with emacsql

(emacsql (org-roam-db) [:select [id
                 file
                 title
                 level
                 pos
                 olp
                 properties
                 (funcall group-concat tag (emacsql-escape-raw "\,"))]
                :as tags
                :from nodes
                :left-join tags
                :on (= id node_id)
                :group :by id])