tshatrov/ichiran

`Database error 42P01: relation "kana_text" does not exist` from CLI due to `switch-conn-vars`

Heliozoa opened this issue · 2 comments

Hi,
Thanks for your work on ichiran.

I was able to prepare the ichiran database using the dump according to the instructions in the blog post (https://readevalprint.tumblr.com/post/639359547843215360/ichiranhome-2021-the-ultimate-guide) with all the tests passing, but when I would build the CLI and try to use it, it was unable to find the database tables.

❯ ./ichiran-cli "こんばんは"
ERROR: Database error 42P01: relation "kana_text" does not exist
QUERY: (SELECT * FROM kana_text WHERE (text IN (E'', E'んは', E'', E'ばんは', E'ばん', E'', E'んばんは', E'んばん', E'んば', E'', E'こんばんは', E'こんばん', E'こんば', E'こん', E'')))

Since the tests worked and I could confirm that the relation does exist with psql, it appeared to me that the CLI might be using some default connection details instead of the ones I gave in the settings.lisp file. I tried removing the following lines which fixed the issue:

ichiran/cli.lisp

Lines 95 to 96 in 3c8891f

(when conn
(switch-conn-vars conn))

I don't know the purpose of these lines, so I decided make an issue instead of a PR removing them.

I see, I must just have gotten lucky/unlucky. I tried building it and running the command several times yesterday and it worked as soon as I removed those lines, however today I can no longer reproduce the issue... Maybe there was some temporary issue with my system that went away after a restart. Sorry for the noise!