<div dir="ltr"><div>Sorry for the uncomplete message.</div><div><br></div><div>I also tried to upgrade a version 16 DB dump from bacula 9.6.7 (debian 12) to version 1025 (bacula 15.0.x) by using the script. I also had to add the -q parameter to the two psql commands. </div><div><br></div><div>I found the solution on this website: <a href="https://dan.langille.org/2023/11/23/bacula-moving-from-9-x-to-13-x-and-upgrading-the-postgresql-database/">https://dan.langille.org/2023/11/23/bacula-moving-from-9-x-to-13-x-and-upgrading-the-postgresql-database/</a> Apparently he had the same problems.</div><div><br></div><div>Do you have any idea, when your patched version of the package 
15.0.3-4 / 15.0.3-5 will be accepted in stable?</div><div><br></div><div>Here is my patch:</div><div>189c189<br><     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<br>---<br>>     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<br>222c222<br><     echo "Loading the File table from $PWD/file.$$.data..."<br>---<br>>     echo "Loading the File table from $PWD/file1017.data..."<br>227c227<br><       echo "Inserting File data from file.$$.data failed."<br>---<br>>       echo "Inserting File data from file1017.data failed."<br>288c288<br><     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<br>---<br>>     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<br>321c321<br><     echo "Loading the File table from $PWD/file.$$.data..."<br>---<br>>     echo "Loading the File table from $PWD/file1016.data..."</div><div><br></div><div>Regards,</div><div>Sebastian</div><div><br></div><div><br></div><div>On Tue, 02 Sep 2025 18:03:07 +0200 Carsten Leonhardt <<a href="mailto:leo@debian.org">leo@debian.org</a>> wrote:</div>> Control: unmerge -1<br>> Control: reopen -1<br>> <br>> Hi Joop,<br>> <br>> actually, we fixed the escaping, but this is the first time we hear<br>> about the "-q" parameter problem.<br>> <br>> We'll need to investigate that. <br>> <br>> Regards<br>> <br>> Carsten<br>> <br>> <br>> Carsten Leonhardt <<a href="mailto:leo@debian.org">leo@debian.org</a>> writes:<br>> <br>> > Control: forcemerge 1108272 -1<br>> ><br>> > Hi Joop,<br>> ><br>> > thanks for your report. We have already addressed this in version<br>> > 15.0.3-4, which unfortunately is not in the current Debian stable<br>> > release (c.f. bug #1108272).<br>> ><br>> > We highly recommend letting dbconfig-common handle the databases.<br>> ><br>> > Regards<br>> ><br>> > Carsten<br>> ><br>> ><br>> > Joop Boonen <<a href="mailto:joop.boonen@credativ.de">joop.boonen@credativ.de</a>> writes:<br>> ><br>> >> Package: bacula-director-pgsql<br>> >><br>> >>  Version: 15.0.3-3<br>> >><br>> >> When I invoke<br>> >><br>> >>  sudo -u postgres /usr/share/bacula-director/update_postgresql_tables -d <bacula_database><br>> >> The Baculadatabase isnt' upgraded due to a few "errors" in the script.<br>> >><br>> >><br>> >><br>> >> The First error the psql dump is created without a -q, this causes that header data ends up in the file. Because of this the restore fails.<br>> >><br>> >><br>> >><br>> >> Secondly the postgresql do $$ is not correctly escaped. Therefore bash replaces the $$ to the current process id.<br>> >><br>> >><br>> >><br>> >><br>> >><br>> >><br>> >><br>> >><br>> >>   I suggest the following patch:<br>> >><br></div>