From: Mantis B. T. <no...@bu...> - 2012-08-16 09:34:38
|
The following issue has been CLOSED ====================================================================== http://bugs.bacula.org/view.php?id=1923 ====================================================================== Reported By: huhnium Assigned To: ====================================================================== Project: bacula Issue ID: 1923 Category: bat Reproducibility: always Severity: minor Priority: normal Status: closed Resolution: open Fixed in Version: ====================================================================== Date Submitted: 2012-08-16 09:32 BST Last Modified: 2012-08-16 10:34 BST ====================================================================== Summary: bat restore => "Can't create restore list" Description: I've figured out that various SQL statements do trigger errors like 'ERROR 1052 (23000): Column 'JobId' in field list is ambiguous'. The DB-backend is mysql-4.1.13. after SQL code fixing the following lines a bat brestore could be performed successful. Please find the following diffs: I) in Bvfs::compute_restore_list(...): --- a/src/cats/bvfs.c Tue Aug 14 13:36:31 2012 +0000 +++ b/src/cats/bvfs.c Thu Aug 16 08:01:45 2012 +0000 @@ -887,7 +887,7 @@ if (*fileid) { /* Select files with their direct id */ init=true; - Mmsg(tmp,"SELECT JobId, JobTDate, FileIndex, FilenameId, PathId, FileId " + Mmsg(tmp,"SELECT File.JobId, JobTDate, FileIndex, FilenameId, PathId, FileId " "FROM File JOIN Job USING (JobId) WHERE FileId IN (%s)", fileid); pm_strcat(query, tmp.c_str()); @@ -929,7 +929,7 @@ query.strcat(" UNION "); } - Mmsg(tmp, "SELECT JobId, JobTDate, File.FileIndex, File.FilenameId, " + Mmsg(tmp, "SELECT Job.JobId, JobTDate, File.FileIndex, File.FilenameId, " "File.PathId, FileId " "FROM Path JOIN File USING (PathId) JOIN Job USING (JobId) " "WHERE Path.Path LIKE '%s' AND File.JobId IN (%s) ", @@ -967,7 +967,7 @@ tmp.strcat(") UNION "); query.strcat(tmp.c_str()); } - Mmsg(tmp, "SELECT JobId, JobTDate, FileIndex, FilenameId, " + Mmsg(tmp, "SELECT Job.JobId, JobTDate, FileIndex, FilenameId, " "PathId, FileId " "FROM File JOIN Job USING (JobId) WHERE JobId = %lld " "AND FileIndex IN (%lld", jobid, id); II:) --- a/src/cats/sql_cmds.c Tue Aug 14 13:36:31 2012 +0000 +++ b/src/cats/sql_cmds.c Thu Aug 16 08:01:45 2012 +0000 @@ -221,7 +221,7 @@ * use Ids to select the FileSet name. (like in accurate) */ const char *uar_sel_filesetid = - "SELECT MAX(FileSetId) " + "SELECT MAX(FileSet.FileSetId) " "FROM FileSet JOIN Job USING (FileSetId) " "WHERE Job.ClientId=%s " "GROUP BY FileSet"; The 5.2.10 bacula version may lead to the same SQL field ambiguity, because the particular SQL code lines seem not to have changed since 5.2.6. Kind regards, Henrik Steps to Reproduce: try to restore a file with brestore from within bat. ====================================================================== ---------------------------------------------------------------------- (0006449) ebollengier (administrator) - 2012-08-16 10:34 http://bugs.bacula.org/view.php?id=1923#c6449 ---------------------------------------------------------------------- Thanks for your fix, it will be included in the next release. Issue History Date Modified Username Field Change ====================================================================== 2012-08-16 09:32 huhnium New Issue 2012-08-16 10:34 ebollengier Note Added: 0006449 2012-08-16 10:34 ebollengier Status new => closed ====================================================================== |