Thread: pgsql: Make command-line tools smarter about finding a DB to connect to

pgsql: Make command-line tools smarter about finding a DB to connect to

From
Robert Haas
Date:
Make command-line tools smarter about finding a DB to connect to.

If unable to connect to "postgres", try "template1".  This allows things to
work more smoothly in the case where the postgres database has been
dropped.  And just in case that's not good enough, also allow the user to
specify a maintenance database to be used for the initial connection, to
cover the case where neither postgres nor template1 is suitable.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/68281e00540a29e7f9bfc154c25a78b875f560d1

Modified Files
--------------
doc/src/sgml/ref/clusterdb.sgml |   12 +++++++++++
doc/src/sgml/ref/createdb.sgml  |   13 ++++++++++++
doc/src/sgml/ref/dropdb.sgml    |   12 +++++++++++
doc/src/sgml/ref/reindexdb.sgml |   12 +++++++++++
doc/src/sgml/ref/vacuumdb.sgml  |   12 +++++++++++
src/bin/scripts/clusterdb.c     |   20 +++++++++++++----
src/bin/scripts/common.c        |   42 ++++++++++++++++++++++++++++++++++++++-
src/bin/scripts/common.h        |    5 ++++
src/bin/scripts/createdb.c      |   19 +++++++++++------
src/bin/scripts/createlang.c    |    5 ++-
src/bin/scripts/createuser.c    |    3 +-
src/bin/scripts/dropdb.c        |   16 ++++++++++----
src/bin/scripts/droplang.c      |    5 ++-
src/bin/scripts/dropuser.c      |    3 +-
src/bin/scripts/reindexdb.c     |   25 ++++++++++++++++------
src/bin/scripts/vacuumdb.c      |   20 +++++++++++++----
16 files changed, 188 insertions(+), 36 deletions(-)