1
0
Fork 0
mirror of https://git.freebsd.org/ports.git synced 2025-06-17 18:50:33 -04:00
ports/sysutils/bacula15-server/files/patch-src_cats_update__postgresql__tables.in
Dan Langille 7ebb2c9f2a sysutils/bacula15-server: patch to fix upgrade script
With upcoming removal of bacula9 and bacula11, let's make this work.

These patches have been submitted upstream but not released:

* 0200b14613
* 716952b15b

While here, remove Makefile.old committed during 9df94c4d9d

PR:		281542
2024-09-17 13:46:48 +00:00

50 lines
3.5 KiB
Text

--- src/cats/update_postgresql_tables.in.orig 2024-09-16 19:41:23 UTC
+++ src/cats/update_postgresql_tables.in
@@ -186,7 +186,7 @@ if [ "$DBVERSION" -eq 15 -o "$DBVERSION" -eq 16 ]; the
echo " doesn't have write permission on the current directory,"
echo " or if the system doesn't have enough space to store a"
echo " compressed export of the File table"
- psql --set ON_ERROR_STOP=1 -d ${db_name} $* -c "set work_mem='$WORKMEM';"'set enable_mergejoin to off ; set enable_hashjoin to off; copy (SELECT FileId, FileIndex, JobId, PathId, Filename.Name, DeltaSeq, MarkId, LStat, Md5 FROM File JOIN Filename USING (FilenameId)) TO STDOUT' | $COMP -1 -c > file1017.data
+ psql -q --set ON_ERROR_STOP=1 -d ${db_name} $* -c "set work_mem='$WORKMEM';"'set enable_mergejoin to off ; set enable_hashjoin to off; copy (SELECT FileId, FileIndex, JobId, PathId, Filename.Name, DeltaSeq, MarkId, LStat, Md5 FROM File JOIN Filename USING (FilenameId)) TO STDOUT' | $COMP -1 -c > file1017.data
if [ $? -ne 0 ]; then
echo "Error while dumping file table to $PWD/file1017.data"
@@ -219,12 +219,12 @@ EOF
exit 1
fi
- echo "Loading the File table from $PWD/file.$$.data..."
+ echo "Loading the File table from $PWD/file1017.data..."
# we do everything in the same commit to avoid creating WALs on this operation
cat file1017.data | $COMP -d | psql --set ON_ERROR_STOP=1 -d ${db_name} $* -c "BEGIN; TRUNCATE File; COPY File FROM STDIN; set maintenance_work_mem='2000MB'; CREATE INDEX file_jpfid_idx on File (JobId, PathId, Filename text_pattern_ops); ALTER TABLE ONLY File ADD CONSTRAINT file_pkey PRIMARY KEY (FileId); COMMIT;"
if [ $? -ne 0 ]; then
- echo "Inserting File data from file.$$.data failed."
+ echo "Inserting File data from file1017.data failed."
exit 1
fi
@@ -285,7 +285,7 @@ if [ "$STOP1015" = "" -a "$DBVERSION" -eq 1015 ]; then
echo " doesn't have write permission on the current directory,"
echo " or if the system doesn't have enough space to store a"
echo " compressed export of the File table"
- psql --set ON_ERROR_STOP=1 -d ${db_name} $* -c "set work_mem='$WORKMEM';"'set enable_mergejoin to off ; set enable_hashjoin to off; copy (SELECT FileId, FileIndex, JobId, PathId, Filename.Name, DeltaSeq, MarkId, LStat, Md5 FROM File JOIN Filename USING (FilenameId)) TO STDOUT' | $COMP -1 -c > file1016.data
+ psql -q --set ON_ERROR_STOP=1 -d ${db_name} $* -c "set work_mem='$WORKMEM';"'set enable_mergejoin to off ; set enable_hashjoin to off; copy (SELECT FileId, FileIndex, JobId, PathId, Filename.Name, DeltaSeq, MarkId, LStat, Md5 FROM File JOIN Filename USING (FilenameId)) TO STDOUT' | $COMP -1 -c > file1016.data
if [ $? -ne 0 ]; then
echo "Error while dumping file table to $PWD/file1016.data"
@@ -318,12 +318,12 @@ EOF
exit 1
fi
- echo "Loading the File table from $PWD/file.$$.data..."
+ echo "Loading the File table from $PWD/file1016.data..."
# we do everything in the same commit to avoid creating WALs on this operation
cat file1016.data | $COMP -d | psql --set ON_ERROR_STOP=1 -d ${db_name} $* -c "BEGIN; TRUNCATE File; COPY File FROM STDIN; set maintenance_work_mem='2000MB'; CREATE INDEX file_jpfid_idx on File (JobId, PathId, Filename text_pattern_ops); ALTER TABLE ONLY File ADD CONSTRAINT file_pkey PRIMARY KEY (FileId); COMMIT;"
if [ $? -ne 0 ]; then
- echo "Inserting File data from file.$$.data failed."
+ echo "Inserting File data from file1016.data failed."
exit 1
fi