I had datadir in /dir1 and I started postmaster with:
postmaster -D /dir1
this recorded "-D /dir1" in /dir1/postmaster.opts. Then I stopped postmaster and moved /dir1 to /dir2. I then started postmaster with:
PG_DATA=/dir2 pg_ctl start
It worked normally. But:
PG_DATA=/dir2 pg_ctl restart
failed when starting postmaster because it used datadir from postmaster.opts (/dir1). This worked though:
pg_ctl restart -D /dir2
So there's a slight inconsistency between the start and restart command.
Would it be nicer if postmaster doesn't record -D in postmaster.opts, or if pg_ctl strips it? Or is it entirely my fault for not adjusting postmaster.opts when I move datadir around? IMO it would be nice if datadir is portable (i.e. it doesn't contain its own full path).
Also pardon my ignorance, but what is the purpose of having postmaster.opts inside datadir?
This is postgresql 7.4.3 on Linux.
-- dave
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend