How do I make Racket notice a SQLite update?

macOS Catalina comes with sqlite3 version 3.28. This version does not include the 'table_list' pragma, so I upgraded to version 3.39.2 (the latest). I have checked the version number on the new version and verified that "select * from pragma_table_list('table-name')" works when run from the sqlite3 CLI.

Unfortunately, Racket does not seem to notice the change and is still claiming that there is no such thing as the 'pragma_table_list' table. I've tried un/reinstalling both Racket 8.5 and the db module itself, to no avail.

Can anyone offer a suggestion, or a pointer to the correct FM?

EDIT: I should mention that I did the upgrade as follows:

$ brew install sqlite   # this installs to /usr/local/opt/sqlite
$ sudo bash
# cd /usr/local/bin/
# mv sqlite3 sqlite3.3.28   # save the old version aside
# cp /usr/local/opt/sqlite/bin/sqlite3 sqlite3.3.39  # copy over the new one
# ln -s sqlite3.3.39  sqlite3  # symlink

The Racket db module uses the libsqlite3.dylib shared library, not the sqlite3 executable.

You probably can't replace /usr/lib/libsqlite3.dylib in the same way as /usr/bin/sqlite3, because macOS keeps the .dylib in a read-only space and makes it appear to be in /usr/lib/libsqlite3.dylib only when loading. But putting the link in the lib directory of your Racket installation should work, since Racket looks there first.

1 Like

facepalm Of course. I figured that the reinstall would update the library as well but I completely braincramped on the fact that it was the library I needed to move, not the executable. Thanks.

EDIT:

For anyone trying to do this, the sequence went as follows:

$ brew install sqlite  # this installs sqlite 3.39.2 into /usr/local/Cellar/sqlite/3.39.2
$ cd /Applications/Racket\ v8.5/lib
$ ln -s /usr/local/Cellar/sqlite/3.39.2/lib/libsqlite3.dylib libsqlite3.0.dylib

Sidebar: I dislike paths with spaces in them, so I always rename the Racket installs to, e.g. "Racket_v8.5". It saves a bunch of backwhacking or quoting.

I wonder if there is a way to do this that doesn’t break every time you upgrade either Racket or SQLite.