Package: postgresql-common
Version: 7
Severity: wishlist
Tags: experimental patch
I have added support for using the environmenit variable PGCLUSTER to
specify which cluster pg_wrapper should use. I needed it to switch
between clusters for different existing scripts and makefiles without
editing ~/.postgresqlrc all the time. I have documented the change in
the POD.
I have also added use strict to the script and included pg_wrapper in
the known commands as mentioned in bug #305200.
Regards,
Kim Hansen
-- System Information:
Debian Release: 3.1
APT prefers unstable
APT policy: (700, 'unstable'), (1, 'experimental')
Architecture: i386 (i586)
Kernel: Linux 2.4.21-pre4
Locale: LANG=C, LC_CTYPE=da_DK (charmap=ISO-8859-1)
-- no debconf information
7a8,9
> use strict;
>
11,12c13,14
< @commands = qw/clusterdb createdb createlang createuser dropdb droplang
dropuser pg_dump
< pg_dumpall pg_restore psql vacuumdb vacuumlo/;
---
> my @commands = qw/clusterdb createdb createlang createuser dropdb droplang
> dropuser pg_config
> pg_dump pg_dumpall pg_restore psql vacuumdb vacuumlo/;
14c16
< $cmd = (split '/', $0)[-1];
---
> my $cmd = (split '/', $0)[-1];
16a19,29
> my ($version, $cluster);
>
> # Check for PGCLUSTER in %ENV
> if (defined $ENV{PGCLUSTER}) {
> ($version, $cluster) = split ('/', $ENV{PGCLUSTER}, 2);
> error 'Invalid version specified with $PGCLUSTER' unless $version;
> error 'Invalid cluster specified with $PGCLUSTER' unless $cluster;
>
> error 'Cluster specified with $PGCLUSTER does not exist' unless
> cluster_exists $version, $cluster;
> }
>
18c31
< for ($i = 0; $i <= $#ARGV; ++$i) {
---
> for (my $i = 0; $i <= $#ARGV; ++$i) {
32a46
> my $db;
35,37c49
< if ($cluster) {
< $port = get_cluster_port($version, $cluster);
< }
---
> my $port = get_cluster_port($version, $cluster) if $cluster;
42c54
< @args = (get_program_path ($cmd, $version));
---
> my @args = (get_program_path ($cmd, $version));
72a85,96
> =head1 ENVIRONMENT
>
> =over
>
> =item B<PGCLUSTER>
>
> If $B<PGCLUSTER> is set, it will have the same effect as the option
> B<--cluster> I<string> where I<string> will be taken as $B<PGCLUSTER>'s
> contents.
>
> =back
>