Bruce Momjian wrote: > Bruce Momjian wrote: > > Tom Lane wrote: > > > Bruce Momjian <br...@momjian.us> writes: > > > > Tom Lane wrote: > > > >> Yeah. I think the only sensible way to do this would be to provide an > > > >> operating mode for the postgres executable that would just parse the > > > >> config file and spit out requested values. > > > > > > > That would certainly solve the problem, though it would have to be > > > > backpatched all the way back to 8.4, and it would require pg_upgrade > > > > users to be on newer minor versions of Postgres. > > > > > > I would just say "no" to people who expect this to work against older > > > versions of Postgres. I think it's sufficient if we get this into HEAD > > > so that it will work in the future. > > > > Well, it is going to work in the future only when the _old_ version is > > 9.2+. Specifically, pg_upgrade using the flag could be patched to just > > 9.2, but the flag has to be supported on old and new backends for that > > to work. > > OK, I started working on #3, which was to start the servers to find the > data_directory setting, and developed the attached patch which mostly > does this. However, I have found serious problems with pg_ctl -w/wait > mode and config-only directories (which pg_upgrade uses), and will start > a new thread to address this issue and then continue with this once that > is resolved.
OK, I have modified the postmaster in PG 9.2 to allow output of the data directory, and modified pg_ctl to use that, so starting in PG 9.2 pg_ctl will work cleanly for config-only directories. I will now work on pg_upgrade to also use the new flag to find the data directory from a config-only install. However, this is only available in PG 9.2, and it will only be in PG 9.3 that you can hope to use this feature (if old is PG 9.2 or later). I am afraid the symlink hack will have to be used for several more years, and if you are supporting upgrades from pre-9.2, perhaps forever. I did find that it is possible to use pg_ctl -w start on a config-only install using this trick: su -l postgres \ -c "env PGPORT=\"5432\" /usr/lib/postgresql-9.1/bin/pg_ctl start -w \ -t 60 -s -D /var/lib/postgresql/9.1/data/ \ -o '-D /etc/postgresql-9.1/ \ --data-directory=/var/lib/postgresql/9.1/data/ \ --silent-mode=true'" Unfortunately pg_upgrade doesn't support the -o option which would make this possible for pg_upgrade. One idea would be to add -o/-O options to pg_upgrade 9.2 to allow this to work even with old installs, but frankly, this is so confusing I am not sure we want to encourage people to do things like this. Of course, the symlink hack is even worse, so maybe there is some merit to this. -- Bruce Momjian <br...@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers