CREATE TEMPORARY TABLE filelist AS
SELECT
	r.repoid,
	fl.filename,
	ft.filetypeid,
	ft.processOrder,
	(STRING_TO_ARRAY(fl.filename, '/'))[2:100] pathparts,
	fl.filesize,
	fl.filemtime moddate
FROM filelistraw fl, gentoobrowse.repos r, gentoobrowse.filetypes ft
WHERE (STRING_TO_ARRAY(fl.filename, '/'))[1] = r.name
AND (STRING_TO_ARRAY(fl.filename, '/'))[2:100] ~ ft.spec
