Skip to main content
The database worker runs SQL against PostgreSQL, MySQL, or SQLite over managed connection pools, and exposes row changes as the observable function database::on-row-changed.

How the worker hosts row changes

An observer passes args { db, table?, ops? }, which the engine validates against the function’s args_format. A missing table means every table of the database, and a missing ops means every operation. onObserverAdded installs the capture for the observer’s table before the observer is accepted, so the trigger exists before the first change it must receive. A database the worker has no connection for is refused with ObserveRejection and UNKNOWN_DB, and the refused observer receives no call. onObserverRemoved releases the capture, and the observer is still removed. onObservationMatch files an observer under the keys of its database, table and operation, and gives each change the keys it is: db|table|op, with * in place of a table or an operation the observer does not name. It selects the observers of a change; it cannot change the call. Before the worker builds a change, isObserved(call) answers whether an observer is filed under one of its keys. To observe this function from another worker, see Observers.