pgenv, a simple but great shell script that helps managing several PostgreSQL instances on your machine, have been improved in the last days.
Thanks to the contribution of Nils Dijk
@thanodnlon GitHub, there is now a new command named
switchthat allows you to quickly prepare the whole environment for a different PostgreSQL version without having to start it.
The problem, as described in this pull request was that the
usecommand, trying to be smart, starts a PostgreSQL instance once it has been chosen. On the other hand,
switch, allows you to pre-select the PostgreSQL instance to use without starting it. This is handy, for example, when you want to compile some code against a particular version of PostgreSQL (managed by
pgenv) but don’t want to waste your computer resources starting up PostgreSQL.
To some extent,
switchcan be thought as an efficient equivalent of:
% pgenv use 14.2 % pgenv stop
The command has been implemented as a subcase of
use, but while
usedoes fire up an instance,
However, in the case an instance is already running, switching to a new instance will stop the previously running one!
Other minor contributionsIf you have
pgenvon the radar, you probably have seen another release in the last days, that covered a bug fix spot by Nils Dijk about the management of the configuration.
pgenvkeeps growing and adding new features, and is becoming a more complex beast than it was in the beginning. Hopefully, it can help your workflow too!