22 ms·
Building postgres server as a library. Some early success, but initdb and in-process restarts are much harder than expected
by deivid 10mo ago
Building postgres server as a library. Some early success, but initdb and in-process restarts are much harder than expected
- mysfi 10mo agoDo you mind elaborating more about the use case? Postgres itself is heavily engineered around OS process boundaries for both correctness and resiliency.
- deivid 10mo agoI'm not sure it'll be a serious project, but the main goal is to use it in CI or dev, where setting up postgres is kind of a pain. I got it to work already by setting up the global context in single-user mode (like postgres --single) and exposing bindings for SPI operations. Yesterday night I got extensions working, but as this project builds as a static archive, the extensions also have to be part of the build. Both plpgsql and pgvector worked fine. The bigger challenge is dealing with global state -- comparing the pre-start and post-shutdown state of the process memory, about 200 globals change state. Been slowly making progress to get restarts working