Bacula-users

[Bacula-users] SQL problem [was: Re: Catalog to accompany job tape sets]

2010-08-14 06:54:46
Subject: [Bacula-users] SQL problem [was: Re: Catalog to accompany job tape sets]
From: Rory Campbell-Lange <rory AT campbell-lange DOT net>
To: bacula-users <bacula-users AT lists.sourceforge DOT net>
Date: Sat, 14 Aug 2010 11:51:31 +0100
On 13/08/10, Rory Campbell-Lange (rory AT campbell-lange DOT net) wrote:
> I'd like to write catalog information to CD/DVD to accompany my tape
> sets, which will be between 1 and 15 LT04 tapes. I'm using Postgres
> for the Catalog. The idea is to make it easy for people to restore from
> these tapes 10 years from now.

I'm trying to dump a manifest of files in the fileset from Postgres to
help achieve my aims above.

I'm trying to work out which tape each file is on, by joining JobMedia
to File. However neither JobMedia.FirstIndex nor JobMedia.StartFile
appear to point to File.FileID.

Can someone point me to the relationship between Media and File?

Thanks
Rory

p.s. My query so far is

   SELECT 
        j.jobid, j.name AS jobname, jmlj.volumename, jmlj.slot, f.fileid,
        p.path, fn.name AS filename, f.md5
   FROM 
        job j, 
        filename fn, 
        path p, 
        file f
   LEFT JOIN 
          ( SELECT 
                jj.jobid, jj.mediaid, m.volumename, 
                m.slot, jj.firstindex, jj.lastindex
           FROM 
                jobmedia jj, media m
          WHERE 
                jj.mediaid = m.mediaid
          ORDER BY 
                jj.jobid, jj.mediaid
          ) jmlj ON 
            jmlj.jobid = f.jobid 
            AND 
            f.fileid >= jmlj.firstindex 
            AND 
            f.fileid <= jmlj.lastindex
   WHERE 
        f.jobid = j.jobid 
        AND 
        f.pathid = p.pathid 
        AND 
        f.filenameid = fn.filenameid;


-- 
Rory Campbell-Lange
rory AT campbell-lange DOT net

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users