It seems like the fa_sha1 column is either 31 or 32 characters long (or 0 or NULL):
use enwiki_p;
SELECT count(*), length(fa_sha1)
FROM filearchive
GROUP BY length(fa_sha1);
SELECT fa_name, fa_size, fa_timestamp, fa_sha1
FROM filearchive
WHERE length(fa_sha1) IS NULL LIMIT 10;
SELECT fa_name, fa_size, fa_timestamp, fa_sha1
FROM filearchive
WHERE length(fa_sha1) = 0 LIMIT 10;
SELECT fa_name, fa_size, fa_timestamp, fa_sha1
FROM filearchive
WHERE length(fa_sha1) = 31 LIMIT 10;
SELECT fa_name, fa_size, fa_timestamp, fa_sha1
FROM filearchive
WHERE length(fa_sha1) = 32 LIMIT 10;
count(*) | length(fa_sha1) |
---|---|
39994 | None |
1096 | 0 |
2304167 | 31 |
775190 | 32 |
When it is 32 chars long, it appears to be zero-padded. oi_sha1
is either 0 or 31 characters long.