Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/sql/40-swh-func.sql
Show First 20 Lines • Show All 308 Lines • ▼ Show 20 Lines | where id = walked_dir_id), | ||||
ls_f as (select dir_id, unnest(file_entries) as entry_id from dir), | ls_f as (select dir_id, unnest(file_entries) as entry_id from dir), | ||||
ls_r as (select dir_id, unnest(rev_entries) as entry_id from dir) | ls_r as (select dir_id, unnest(rev_entries) as entry_id from dir) | ||||
(select dir_id, 'dir'::directory_entry_type as type, | (select dir_id, 'dir'::directory_entry_type as type, | ||||
e.target, e.name, e.perms, NULL::content_status, | e.target, e.name, e.perms, NULL::content_status, | ||||
NULL::sha1, NULL::sha1_git, NULL::sha256, NULL::bigint | NULL::sha1, NULL::sha1_git, NULL::sha256, NULL::bigint | ||||
from ls_d | from ls_d | ||||
left join directory_entry_dir e on ls_d.entry_id = e.id) | left join directory_entry_dir e on ls_d.entry_id = e.id) | ||||
union | union | ||||
(with known_contents as | |||||
(select dir_id, 'file'::directory_entry_type as type, | (select dir_id, 'file'::directory_entry_type as type, | ||||
ardumont: misindented i think. | |||||
e.target, e.name, e.perms, c.status, | e.target, e.name, e.perms, c.status, | ||||
c.sha1, c.sha1_git, c.sha256, c.length | c.sha1, c.sha1_git, c.sha256, c.length | ||||
from ls_f | from ls_f | ||||
left join directory_entry_file e on ls_f.entry_id = e.id | left join directory_entry_file e on ls_f.entry_id = e.id | ||||
left join content c on e.target = c.sha1_git) | inner join content c on e.target = c.sha1_git) | ||||
select * from known_contents | |||||
union | |||||
(select dir_id, 'file'::directory_entry_type as type, | |||||
e.target, e.name, e.perms, c.status, | |||||
c.sha1, c.sha1_git, c.sha256, c.length | |||||
from ls_f | |||||
left join directory_entry_file e on ls_f.entry_id = e.id | |||||
left join skipped_content c on e.target = c.sha1_git | |||||
where not exists (select 1 from known_contents where known_contents.sha1_git=e.target))) | |||||
union | union | ||||
(select dir_id, 'rev'::directory_entry_type as type, | (select dir_id, 'rev'::directory_entry_type as type, | ||||
e.target, e.name, e.perms, NULL::content_status, | e.target, e.name, e.perms, NULL::content_status, | ||||
NULL::sha1, NULL::sha1_git, NULL::sha256, NULL::bigint | NULL::sha1, NULL::sha1_git, NULL::sha256, NULL::bigint | ||||
from ls_r | from ls_r | ||||
left join directory_entry_rev e on ls_r.entry_id = e.id) | left join directory_entry_rev e on ls_r.entry_id = e.id) | ||||
order by name; | order by name; | ||||
$$; | $$; | ||||
▲ Show 20 Lines • Show All 620 Lines • Show Last 20 Lines |
misindented i think.