2 ms·
> [...] was somewhat shocked recently looking into MySQL and SQLite to learn that even in 2024, no equivalent exists. I'm not sure how one would make `NOTIFY`
by cryptonector 2y ago
> [...] was somewhat shocked recently looking into MySQL and SQLite to learn that even in 2024, no equivalent exists.
I'm not sure how one would make `NOTIFY` work on SQLite3. Maybe one could have a system table (`sqlite_temp_notifies`?) that would store notifies, and then have a directory associated with the database where one can create pipes/AF_LOCAL sockets that a process/thread running `NOTIFY` would attempt to write to in a non-blocking manner, then delete the notifies from that system table. The system table would only be needed to make notifies reliable while "connected" to the database and LISTENing (i.e., having registered the pipe/socket).
I agree that that would be very useful.
A couple of things:
- LISTEN/NOTIFY lacks authorization on the channel. Indeed, channels are not even CREATEd. This means you cannot trust NOTIFY payloads if users you don't trust have access to the database.
- NOTIFYs are lost if no client is LISTENing.
In practice this means that NOTIFYs are only good for waking clients that then have to check what's up with a query.