[pkg-bacula-commits] [bacula] 03/03: added patch to fix update script for postgresql databases the upstream update-postgresql-tables script throws an error on the optional last part of the update

Carsten Leonhardt leo at moszumanska.debian.org
Sun May 22 19:05:48 UTC 2016


This is an automated email from the git hooks/post-receive script.

leo pushed a commit to branch experimental
in repository bacula.

commit 74959ea07532aea4af45edb2fba4c4b88bbc34e4
Author: Carsten Leonhardt <leo at debian.org>
Date:   Sun May 22 21:04:35 2016 +0200

    added patch to fix update script for postgresql databases
    the upstream update-postgresql-tables script throws an error on the
    optional last part of the update
---
 debian/changelog                             |  1 +
 debian/patches/fix-update-pgsql-script.patch | 26 ++++++++++++++++++++++++++
 debian/patches/series                        |  1 +
 debian/scripts/install-dbconfig-upgrade      |  2 +-
 4 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 414f4be..8ed3b2a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,7 @@ bacula (7.4.0+dfsg-1) experimental; urgency=low
   * Update Standards-Version to 3.9.8. No changes required.
   * bacula-director-pgsql no longer suggests postgresql-doc
   * created new scripts to cope with new database update scripts
+  * added patch to fix update script for postgresql databases
 
  --
 
diff --git a/debian/patches/fix-update-pgsql-script.patch b/debian/patches/fix-update-pgsql-script.patch
new file mode 100644
index 0000000..4046461
--- /dev/null
+++ b/debian/patches/fix-update-pgsql-script.patch
@@ -0,0 +1,26 @@
+Description: fix update-postgresql-tables
+ upstreams version throws an error on an optional operation
+Author: Carsten Leonhardt <leo at debian.org>
+Bug: http://bugs.bacula.org/view.php?id=2227
+--- a/src/cats/update_postgresql_tables.in
++++ b/src/cats/update_postgresql_tables.in
+@@ -145,6 +145,6 @@
+ # It may fail, but it's not a big problem
+ psql -f - -d ${db_name} $* <<END-OF-DATA
+ set client_min_messages = fatal;
+-CREATE INDEX media_poolid_idx on Media (PoolId);
+-CREATE INDEX media_storageid_idx ON Media (StorageId);
++CREATE INDEX IF NOT EXISTS media_poolid_idx on Media (PoolId);
++CREATE INDEX IF NOT EXISTS media_storageid_idx ON Media (StorageId);
+ END-OF-DATA
+--- a/updatedb/update_postgresql_tables.in
++++ b/updatedb/update_postgresql_tables.in
+@@ -145,6 +145,6 @@
+ # It may fail, but it's not a big problem
+ psql -f - -d ${db_name} $* <<END-OF-DATA
+ set client_min_messages = fatal;
+-CREATE INDEX media_poolid_idx on Media (PoolId);
+-CREATE INDEX media_storageid_idx ON Media (StorageId);
++CREATE INDEX IF NOT EXISTS media_poolid_idx on Media (PoolId);
++CREATE INDEX IF NOT EXISTS media_storageid_idx ON Media (StorageId);
+ END-OF-DATA
diff --git a/debian/patches/series b/debian/patches/series
index 7adedca..19b46d9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,4 @@ fix-mysql-libdir.patch
 fix-scriptdir-examples-devices.patch
 fix-systemd-tmpfiles.d-location.patch
 enable-hardening-for-bat.patch
+fix-update-pgsql-script.patch
diff --git a/debian/scripts/install-dbconfig-upgrade b/debian/scripts/install-dbconfig-upgrade
index fab72da..a681133 100755
--- a/debian/scripts/install-dbconfig-upgrade
+++ b/debian/scripts/install-dbconfig-upgrade
@@ -46,7 +46,7 @@ while [ $dbtarget -le $lastdbversion ]; do
 	if [ $db = pgsql ]; then
 	    if [ $dbtarget -eq 15 ]; then
 		# the double awk invocation tries to make extra sure we get the correct instructions
-		awk '/For all versions, we need to create the Index on Media/ , /^END-OF-DATA$/' $sourcefile | awk '/set client_min_messages/, /CREATE INDEX media_storageid_idx ON Media/' >> $targetfile
+		awk '/For all versions, we need to create the Index on Media/ , /^END-OF-DATA$/' $sourcefile | awk '/set client_min_messages/, /CREATE INDEX (IF NOT EXISTS )?media_storageid_idx ON Media/' >> $targetfile
 	    fi
 	fi
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bacula/bacula.git



More information about the pkg-bacula-commits mailing list