Scalar Functions — Hash / Crypto
Hash functions compute digests over string values. MySQL and ClickHouse support MD5, SHA-1 and SHA-256 natively. PostgreSQL provides MD5 natively and reaches the other two through an extension — see the warning below. DuckDB supports MD5 and SHA-256 natively but has no native SHA-1 function, so hash_sha1() is approximated as SHA-256 there. SQLite has no built-in hash functions and will emit a warning and fail for any of these calls.
On PostgreSQL these lower to digest(), which is not part of core PostgreSQL. It comes from the pgcrypto extension, so a query using them fails with function digest does not exist on a database where that extension has not been installed.
Install it once per database with CREATE EXTENSION pgcrypto;. MD5 is the exception — PostgreSQL provides md5() natively and it needs no extension.
Legend: ✅ Supported · ⚠️ Approximated · ❌ Not Supported · 🔄 Rewritten
| Function | SQLite | MySQL | ClickHouse | PostgreSQL | DuckDB | Notes |
|---|---|---|---|---|---|---|
hash_md5() | ❌ | ✅ | ✅ | ✅ | ✅ | DuckDB: md5(); SQLite: not supported (emits a warning and fails) |
hash_sha256() | ❌ | ✅ | ✅ | ✅ | ✅ | MySQL: SHA2(col, 256); DuckDB: sha256(); SQLite: not supported |
hash_sha1() | ❌ | ✅ | ✅ | ✅ | ⚠️ | MySQL: SHA1(); Postgres: encode(digest(...,'sha1'),'hex'); DuckDB: approximated as sha256() (no native SHA-1); SQLite: not supported |
hash() | ❌ | ❌ | ❌ | ❌ | ✅ | DuckDB has a native hash(); MySQL, ClickHouse, and PostgreSQL have no generic hash() and emit a non-existent builtin that fails at runtime; SQLite: not supported |
SQLite does not include any cryptographic functions. Using hash_md5(), hash_sha1(), or hash_sha256() against a SQLite target will emit a runtime warning. If hashing is required, consider switching to a ClickHouse or PostgreSQL target for those pipeline stages.