Page MenuHomeSoftware Heritage

mark-as-missing.sql

Authored By
zack
Nov 3 2017, 2:35 PM
Size
872 B
Subscribers
None

mark-as-missing.sql

BEGIN;
CREATE TEMPORARY TABLE tmp_oversize_contents (sha1 sha1 PRIMARY KEY);
COPY tmp_oversize_contents
FROM PROGRAM 'xzcat /tmp/oversize-contents.txt.xz | sed ''s/^/\\\\x/''';
INSERT INTO skipped_content
(sha1, sha1_git, sha256, blake2s256, length, ctime, object_id,
status, reason)
SELECT sha1, sha1_git, sha256, blake2s256, length, ctime, object_id,
'absent', 'Content too large'
FROM content
WHERE sha1 IN (SELECT sha1 FROM tmp_oversize_contents)
ON CONFLICT (sha1_git) DO UPDATE SET
sha1 = EXCLUDED.sha1,
sha1_git = EXCLUDED.sha1_git,
sha256 = EXCLUDED.sha256,
blake2s256 = EXCLUDED.blake2s256,
length = EXCLUDED.length,
ctime = LEAST(skipped_content.ctime, EXCLUDED.ctime),
object_id = EXCLUDED.object_id
;
DELETE FROM content WHERE sha1 IN (SELECT sha1 FROM tmp_oversize_contents);
COMMIT;

File Metadata

Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
204803

Event Timeline

zack changed the visibility from "zack (Stefano Zacchiroli)" to "Public (No Login Required)".Nov 3 2017, 2:37 PM