Skip to content

Instantly share code, notes, and snippets.

@bfritz
Created February 13, 2012 15:32
Show Gist options
  • Save bfritz/1817618 to your computer and use it in GitHub Desktop.
Save bfritz/1817618 to your computer and use it in GitHub Desktop.
pg_upgradecluster patch to upgrade from 8.2 to 8.4 (Lenny --> Squeeze)
--- /usr/bin/pg_upgradecluster 2012-02-13 10:23:56.000000000 -0500
+++ /usr/bin/pg_upgradecluster.mod 2012-02-13 10:23:44.000000000 -0500
@@ -270,6 +270,11 @@
error 'could not get cluster collating locale' unless $old_lc_collate;
}
+$encoding = "UTF-8";
+$lc_ctype = "en_US.UTF-8";
+$lc_collate = "en_US.UTF-8";
+
+
if (cluster_exists $newversion, $cluster) {
error "target cluster $newversion/$cluster already exists";
}
@@ -282,7 +287,8 @@
# stopping old cluster, so that we notice early when there are still
# connections
print "Stopping old cluster...\n";
-my @argv = ('pg_ctlcluster', $version, $cluster, 'stop', '--', '-t', '5');
+#my @argv = ('pg_ctlcluster', $version, $cluster, 'stop', '--', '-t', '5');
+my @argv = ('pg_ctlcluster', $version, $cluster, 'stop');
error "Could not stop old cluster" if system @argv;
# Disable access to clusters during upgrade
@@ -422,6 +428,8 @@
# Upgrade databases
for my $db (keys %databases) {
next if $db eq 'template0';
+ next if $db eq 'template1';
+ next if $db eq 'postgres';
print "Fixing hardcoded library paths for stored procedures...\n";
(system $psql, '-h', $oldsocket, '-p', $info{'port'}, '-q', '-d',
@bfritz
Copy link
Author

bfritz commented Feb 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment