postmaster.opts, moving datadir around, and pg_ctl - Mailing list pgsql-hackers

From David Garamond
Subject postmaster.opts, moving datadir around, and pg_ctl
Date
Msg-id 4103AB5E.5070905@zara.6.isreserved.com
Whole thread Raw
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: David Garamond
Date:
Subject: pg_ctl and failing postmaster
Next
From: Bruno Wolff III
Date:
Subject: Re: [DOCS] 7.5 release notes