From: Eric Bollengier Date: Sun, 21 Nov 2010 12:41:34 +0000 (+0100) Subject: Modify MySQL accurate query with Delta X-Git-Tag: Release-5.2.1~896 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e3f8276f727cc6fac64d281c46e30ecbb8242937;p=bacula%2Fbacula Modify MySQL accurate query with Delta Choose File.MarkId instead of T1.MarkId to be consistent with other fields --- diff --git a/bacula/src/cats/sql_cmds.c b/bacula/src/cats/sql_cmds.c index 8ba88be632..85e1f0263a 100644 --- a/bacula/src/cats/sql_cmds.c +++ b/bacula/src/cats/sql_cmds.c @@ -362,20 +362,20 @@ const char *select_recent_version_with_basejob[5] = { */ const char *select_recent_version_with_basejob_and_delta_default = "SELECT FileId, Job.JobId AS JobId, FileIndex, File.PathId AS PathId, " - "File.FilenameId AS FilenameId, LStat, MD5, T1.MarkId AS MarkId, " + "File.FilenameId AS FilenameId, LStat, MD5, File.MarkId AS MarkId, " "Job.JobTDate AS JobTDate " "FROM Job, File, ( " "SELECT MAX(JobTDate) AS JobTDate, PathId, FilenameId, MarkId " "FROM ( " - "SELECT JobTDate, PathId, FilenameId, MarkId " /* Get all normal files */ - "FROM File JOIN Job USING (JobId) " /* from selected backup */ - "WHERE File.JobId IN (%s) " - "UNION ALL " - "SELECT JobTDate, PathId, FilenameId, MarkId " /* Get all files from */ - "FROM BaseFiles " /* BaseJob */ - "JOIN File USING (FileId) " - "JOIN Job ON (BaseJobId = Job.JobId) " - "WHERE BaseFiles.JobId IN (%s) " /* Use Max(JobTDate) to find */ + "SELECT JobTDate, PathId, FilenameId, MarkId " /* Get all normal files */ + "FROM File JOIN Job USING (JobId) " /* from selected backup */ + "WHERE File.JobId IN (%s) " + "UNION ALL " + "SELECT JobTDate, PathId, FilenameId, MarkId " /* Get all files from */ + "FROM BaseFiles " /* BaseJob */ + "JOIN File USING (FileId) " + "JOIN Job ON (BaseJobId = Job.JobId) " + "WHERE BaseFiles.JobId IN (%s) " /* Use Max(JobTDate) to find */ ") AS tmp " "GROUP BY PathId, FilenameId, MarkId " /* the latest file version */ ") AS T1 "