Page MenuHomeSoftware Heritage

No OneTemporary

diff --git a/sql/swh-init.sql b/sql/swh-init.sql
index bd12772d..7d1800a4 100644
--- a/sql/swh-init.sql
+++ b/sql/swh-init.sql
@@ -1,5 +1,5 @@
-
create extension if not exists btree_gist;
+create extension if not exists pgcrypto;
create or replace language plpgsql;
create or replace language plpython3u;
diff --git a/sql/upgrades/096.sql b/sql/upgrades/096.sql
index 11c1b847..88b090b1 100644
--- a/sql/upgrades/096.sql
+++ b/sql/upgrades/096.sql
@@ -1,32 +1,38 @@
-- SWH DB schema upgrade
-- from_version: 95
-- to_version: 96
-- description: Use strict equality for searching symbols
insert into dbversion(version, release, description)
values(96, now(), 'Work In Progress');
drop trigger if exists content_ctags_tsvectorupdate on content_ctags;
alter table content_ctags drop column searchable_symbol;
drop function swh_content_ctags_search(text, integer, integer);
create or replace function swh_content_ctags_search(
expression text,
l integer default 10,
last_sha1 sha1 default '\x0000000000000000000000000000000000000000')
returns setof content_ctags_signature
language sql
as $$
select id, name, kind, line, lang
from content_ctags
where name = expression
and id > last_sha1
order by id
limit l;
$$;
comment on function swh_content_ctags_search(text, integer, sha1) IS 'Equality search through ctags'' symbols';
-create index on content_ctags(name);
+create or replace function hash_sha1(text)
+ returns text
+as $$
+ select encode(digest($1, 'sha1'), 'hex')
+$$ language sql strict immutable;
+
+create index on content_ctags(hash_sha1(name));

File Metadata

Mime Type
text/x-diff
Expires
Fri, Jul 4, 11:49 AM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3258758

Event Timeline