Srinath Reddy Sadipiralla <srinath2133@gmail.com> writes:
> I have a question about the initdb success
> message to start the server using pg_ctl. Can we update the -l logfile
> suggestion it prints at the end to something like -l
> /path/to/datadirectory/logfile instead?
"-l logfile" should be read as a recommendation to write to some
logfile, not as the literal text of the command. I don't think
that putting the log file into the data directory is good practice,
either.
> Here’s the issue I’m seeing: when PostgreSQL is installed from packages
> rather than built from source, the installation requires root privileges
> (sudo).
> That means directories like bin and lib are owned by root, and
> non-superusers
> can’t create new files there.
> If someone runs initdb from inside the bin directory and then blindly
> copy-pastes
> the suggested pg_ctl command, pg_ctl will attempt to write the logfile into
> the bin directory.
All of this seems to be predicated on the idea that someone would cd
into the bin directory and try to do work there. I don't understand
why we should regard that scenario as sufficiently probable to justify
contorting PG's behavior to make it fractionally less dangerous.
regards, tom lane