My friend Saxnot was emphasising /never/ re-implementing the Postgres DB server as part of the scope of basically any other programming. I have made explicit some notes that I think constitute what common database server useage is like, and a cringy horror story that literally happened.
You have the DB server running on a machine somewhere on your local network or a situation similar to that. It is a big piece of software, probably started and running persistently in the background, managed by your choice of system service manager like rcctl(8) (sysadmin things).
In your lisp image or analogous thing, you load your database connector, which performs the network connections to your database server from your program and sends SQL language query strings to it, and receives the responses and SQL database errors. I guess Postmodern is one for Postgres, though I see their readme does not contain the words âthis is a DB connectorâ. âDB connectorâ was the language that was normal at some company I worked for though.
You then query your database server via SQL in your program to update values in your running application database (the variables/memory inside your lisp image), and commit new values from your application database to the database server to save them.
The idea being that by inserting a postgres database server into your own programs, you gain its reliability and performance under heavy transaction (sql query sending) loads, while the server itself is being managed by your operating system, with your particular program just connecting to it when it needs to. Multiple programs can use the database server concurrently.
I think everyone agrees that a wide breadth of stateful programming does not require and is not well suited to common database servers and I was simply putting some down in ink here for context.
On the other hand, Saxnotâs point is well taken not to spend your life trying to meaningfully duplicate Postgres DB or the linux kernel as part of other programming projects.
At the last emacsconf (2024), someone gave a talk about their emacs elisp Postgres database mode. My comment to them at the time was that I did not like using SQL and such database servers but they pointed out to me that what their emacs mode was doing in this case was protecting emacs users from experiencing conventional SQL / database server useage which was a totally reasonable point.
About 10 years ago I was working at a company that had managed to wrest the contract to do some domestic automotive companyâs sales databasing from its previous host. At the same time, the company was pushing for their non-managerial staff to accept pay cuts to improve their profits. To demonstrate that their technical staff were easily replaceable, they put a plucky, well-meaning junior sort-of-web-designer in charge of that database. They ran some code they got off the internet to try and do whatever they were being told to do, and dropped the databaseâs tables. Because the database had recently been poached from another IT company, there was no very recent backup. I was happy to leave rather than accept their paycuts, and have not considered any position labelled âdata scienceâ in New Zealand since.
Other than sharing a cringy story, I think this shows some of the strain and risk of injecting (so to speak) SQL language into programming and maintenance tasks done by programmers of a different host language. While we can all agree that it should be inconceivable for what I shared to have happened, at least in New Zealand stuff like this is quite common.
I hope you donât mind the slightly less serious post. (You could tell me your sensibilities and advice on the Mastodon).
screwlisp proposes kittens