> Anyway since postgres uses WAL files to verify the integrity of the database
> couldn't it more or less make the same guarantee's in an embedded version?
> As long as the app uses the db libs unmodified and doesn't mess with the
> files it creates how does simply making it embedded increase the change of
> db errors resulting in database corruption?
I have a different idea. I've been thinking about coding it, but haven't
had the time. This could be done with no changes to Postgres itself.
Basically, you would have a library which exported functions such as
pg_instance *pg_start(char *directory);
pg_get_connection(pg_instance *);
pg_stop(pg_instance *);
pg_initdb(char *directory)
pg_start would do the following:
1) check "directory" for an instance of the UNIX socket.
if it is there, make a Postgres connection
if it is not there, start the Postmaster server with "-k directory
-D directory/data" and then make a Postgres connection
2) Create a struct to contain the directory and any other data item we
need to connect to the database
3) Return this structure
pg_get_connection would just be a wrapper for pq_connect()
pg_stop would kill the database.
pg_initdb would simply run initdb
Does anyone see a reason why this wouldn't work?
Jon