pg_ctl -D means different things depending on whether you are calling
"start" or "stop". For "start", pg_ctl wants the directory
postgresql.conf is in, and for "stop" it wants the directory
postmaster.pid is in. This means that if your .conf files are not in
the same directory as data_directory, you have to write special-case
code for start and stop.
Given that having the .conf files in /etc is the default configuration
for both Red Hat and Debian, this seems like really poor UI design on
our part. Also, it makes the "data_directory" parameter somewhat
disingenous, because effectively that parameter doesn't work all the time.
It actually seems relatively easy to fix this without breaking
backwards-compatibility. We should add this logic to "pg_ctl stop":
1) if postmaster.pid is in -D, shut down that pid.
2) if postmaster.pid is not in -D, look for postgresql.conf
3) if postgresql.conf is found, look in data_directory for postmaster.pid
This would end the pg_ctl breakage on our most popular platforms, while
not changing any functionality for those already installed. Objections?
PostgreSQL Experts Inc.