Bad UI design: pg_ctl and data_directory - Mailing list pgsql-hackers

From Josh Berkus
Subject Bad UI design: pg_ctl and data_directory
Date
Msg-id 4DE6994C.7010604@agliodbs.com
Whole thread Raw
Responses Re: Bad UI design: pg_ctl and data_directory
List pgsql-hackers
All,

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?

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [BUGS] BUG #6034: pg_upgrade fails when it should not.
Next
From: Florian Pflug
Date:
Subject: Re: [BUGS] BUG #6034: pg_upgrade fails when it should not.