Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/sql/40-swh-func.sql
Show First 20 Lines • Show All 674 Lines • ▼ Show 20 Lines | |||||
create or replace function swh_release_add() | create or replace function swh_release_add() | ||||
returns void | returns void | ||||
language plpgsql | language plpgsql | ||||
as $$ | as $$ | ||||
begin | begin | ||||
perform swh_person_add_from_release(); | perform swh_person_add_from_release(); | ||||
insert into release (id, target, target_type, date, date_offset, date_neg_utc_offset, name, comment, author, synthetic) | insert into release (id, target, target_type, date, date_offset, date_neg_utc_offset, name, comment, author, synthetic) | ||||
select t.id, t.target, t.target_type, t.date, t.date_offset, t.date_neg_utc_offset, t.name, t.comment, a.id, t.synthetic | select distinct t.id, t.target, t.target_type, t.date, t.date_offset, t.date_neg_utc_offset, t.name, t.comment, a.id, t.synthetic | ||||
from tmp_release t | from tmp_release t | ||||
left join person a on a.fullname = t.author_fullname; | left join person a on a.fullname = t.author_fullname | ||||
vlorentz: why the `where` is needed? the python code already calls `release_missing` in the same… | |||||
Not Done Inline Actionsping? vlorentz: ping? | |||||
Not Done Inline ActionsIt'd be great if we could just paste that snippet into an explain... ardumont: It'd be great if we could just paste that snippet into an explain...
we can't because the… | |||||
Done Inline ActionsIt's not strictly needed; it's more of a belt + suspenders kind of thing. olasd: It's not strictly needed; it's more of a belt + suspenders kind of thing. | |||||
Not Done Inline ActionsI don't get the point, but whatever... vlorentz: I don't get the point, but whatever... | |||||
where not exists (select 1 from release where t.id = release.id); | |||||
return; | return; | ||||
end | end | ||||
$$; | $$; | ||||
-- add a new origin_visit for origin origin_id at date. | -- add a new origin_visit for origin origin_id at date. | ||||
-- | -- | ||||
-- Returns the new visit id. | -- Returns the new visit id. | ||||
▲ Show 20 Lines • Show All 426 Lines • Show Last 20 Lines |
why the where is needed? the python code already calls release_missing in the same transaction