Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit b039c0b

Browse files
committed
fix local id aggregation
1 parent 578eb23 commit b039c0b

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

src-admintool/queries/producer_files_query.rb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,20 @@ def get_sql
2020
billable_size,
2121
digest_value,
2222
f.created,
23-
loc.local_id
23+
loc.loc_id_agg
2424
from
2525
inv.inv_objects o
2626
inner join inv.inv_files f
2727
on f.inv_object_id = o.id and source = 'producer'
2828
inner join inv.inv_versions v
2929
on f.inv_version_id = v.id
30-
left join inv.inv_localids loc
31-
on o.ark = loc.inv_object_ark
30+
left join
31+
(
32+
select inv_object_ark, group_concat(local_id) as loc_id_agg
33+
from inv.inv_localids
34+
group by inv_object_ark
35+
) loc
36+
on o.ark = inv_object_ark
3237
where exists (
3338
select 1
3439
from
@@ -80,7 +85,7 @@ def get_sql
8085
%{
8186
select
8287
distinct o.ark,
83-
loc.local_id,
88+
loc.loc_id_agg,
8489
replace(o.erc_what, '"', "'") as erc_what,
8590
replace(o.erc_when, '"', "'") as erc_when,
8691
replace(o.erc_who, '"', "'") as erc_who,
@@ -103,8 +108,13 @@ def get_sql
103108
inv.inv_objects o
104109
inner join billing.object_size os
105110
on os.inv_object_id = o.id
106-
left join inv.inv_localids loc
107-
on o.ark = loc.inv_object_ark
111+
left join
112+
(
113+
select inv_object_ark, group_concat(local_id) as loc_id_agg
114+
from inv.inv_localids
115+
group by inv_object_ark
116+
) loc
117+
on o.ark = inv_object_ark
108118
where exists (
109119
select 1
110120
from

0 commit comments

Comments
 (0)