Hi,
Probably a fairly simple question:
For various reasons, I'd like to implement a readonly
backend option. I've been poking around the backend
code, and am slowly getting a feel for it, but I'm far
from sure of the best way to implement such an option.
There are basically two parts that I'd like to hack:
1. To block insert/update/delete/create/alter/drop queries with a helpful message.
2. The ability to open the datafiles read-only (WAL included) so that they can be held on a read-only filesystem.
The latter should be doable, but will require some
effort and testing to catch everything. But where in
the backend should be checks for the former go? I
guess that the executor might be a better place than
the parser, but should I go even lower? There seemed
no obvious way for ExecAppend (for example) to return
failure. Do I just do an elog(NOTICE) and ignore the
query?
I would also like for a readonly backend to be able
safely to coexist with a writable one. Might this be
possible, or are there cases where a backend executing
a readonly transaction needs write something?
Matthew.