From 194133f1dc7e1a28d44f61afe85b3428841a28c4 Mon Sep 17 00:00:00 2001
From: unknown <martin@piware.de>
Date: Sat, 22 Jul 2006 17:46:41 +0200
Subject: [PATCH] * pg_wrapper: Improve manpage POD, describe the precise rules
 for cluster   selection.

---
 postgresql-common/debian/changelog |  5 +--
 postgresql-common/pg_wrapper       | 53 ++++++++++++++++++++++++++----
 2 files changed, 50 insertions(+), 8 deletions(-)

diff --git a/postgresql-common/debian/changelog b/postgresql-common/debian/changelog
index 02811751..514bdaf7 100644
--- a/postgresql-common/debian/changelog
+++ b/postgresql-common/debian/changelog
@@ -1,8 +1,9 @@
 postgresql-common (58) unstable; urgency=low
 
-  *
+  * pg_wrapper: Improve manpage POD, describe the precise rules for cluster
+    selection.
 
- -- Martin Pitt <mpitt@debian.org>  Fri, 30 Jun 2006 00:22:34 +0200
+ -- Martin Pitt <mpitt@debian.org>  Sat, 22 Jul 2006 17:45:56 +0200
 
 postgresql-common (57) unstable; urgency=low
 
diff --git a/postgresql-common/pg_wrapper b/postgresql-common/pg_wrapper
index a0067435..40f3b748 100755
--- a/postgresql-common/pg_wrapper
+++ b/postgresql-common/pg_wrapper
@@ -89,12 +89,53 @@ configured cluster and database for the user and calls the appropriate version
 of the desired program to connect to that cluster and database, supplying any
 specifed options to that command.
 
-By default, the cluster is determined from the configuration files
-L<user_clusters(5)> and L<postgresqlrc(5)>. However, this can be overriden by
-specifying the C<$PGCLUSTER> environment variable or the B<--cluster>
-I<version>/I<cluster> option.  I<cluster> is either the name of a local
-cluster, or takes the form I<host>:I<port> for a remote cluster. If I<port> is
-left empty (i. e. you just specify I<host:>), it defaults to 5432.
+The target cluster is selected by the following means, in descending order of
+precedence:
+
+=over
+
+=item 1.
+
+explicit specification with the B<--cluster> option
+
+=item 2.
+
+explicit specification with the B<PGCLUSTER> environment variable
+
+=item 3.
+
+matching entry in C<~/.postgresqlrc> (see L<postgresqlrc(5)>), if that
+file exists
+
+=item 4.
+
+matching entry in C</etc/postgresql-common/user_clusters> (see
+L<user_clusters(5)>), if that file exists
+
+=item 5.
+
+If only one local cluster exists, that one will be selected.
+
+=item 6.
+
+If several local clusters exist, the one listening on the default port 5432
+will be selected.
+
+=back
+
+If none of these rules match, B<pg_wrapper> aborts with an error.
+
+=head1 OPTIONS
+
+=over
+
+=item B<--cluster> I<version>B</>I<cluster>
+
+I<cluster> is either the name of a local cluster, or takes the form
+I<host>:I<port> for a remote cluster. If I<port> is left empty (i. e. you just
+specify I<host:>), it defaults to 5432.
+
+=back
 
 =head1 ENVIRONMENT
 
-- 
GitLab