Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/sql/40-funcs.sql
Show First 20 Lines • Show All 543 Lines • ▼ Show 20 Lines | begin | ||||
from tmp_revision t | from tmp_revision t | ||||
left join person a on a.fullname = t.author_fullname | left join person a on a.fullname = t.author_fullname | ||||
left join person c on c.fullname = t.committer_fullname; | left join person c on c.fullname = t.committer_fullname; | ||||
return; | return; | ||||
end | end | ||||
$$; | $$; | ||||
-- Create entries in extid from tmp_extid | |||||
-- operates in bulk: 0. swh_mktemp(extid), 1. COPY to tmp_extid, | |||||
-- 2. call this function | |||||
create or replace function swh_extid_add() | |||||
returns void | |||||
language plpgsql | |||||
as $$ | |||||
begin | |||||
insert into extid (extid_type, extid, target_type, target) | |||||
select distinct t.extid_type, t.extid, t.target_type, t.target | |||||
olasd: And we'll want to add an "on conflict (extid_pkey) do nothing" to this insert to avoid bombing… | |||||
from tmp_extid t | |||||
on conflict do nothing; | |||||
return; | |||||
end | |||||
$$; | |||||
-- Create entries in person from tmp_release | -- Create entries in person from tmp_release | ||||
create or replace function swh_person_add_from_release() | create or replace function swh_person_add_from_release() | ||||
returns void | returns void | ||||
language plpgsql | language plpgsql | ||||
as $$ | as $$ | ||||
begin | begin | ||||
with t as ( | with t as ( | ||||
select distinct author_fullname as fullname, author_name as name, author_email as email from tmp_release | select distinct author_fullname as fullname, author_name as name, author_email as email from tmp_release | ||||
▲ Show 20 Lines • Show All 401 Lines • Show Last 20 Lines |
And we'll want to add an "on conflict (extid_pkey) do nothing" to this insert to avoid bombing out on already existing entries.