postgresql – Debian 上没有 crypt 功能

jiw*_*ene 0 postgresql debian crypt postgresql-9.6 debian-stretch

我的 Debian Stretch (9) 上安装了 PostgreSQL 9.6。当我想使用crypt()gen_salt()函数时,它说:

ERROR:  function gen_salt(unknown, integer) does not exist
LINE 1: select gen_salt('bf', 8)
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
Run Code Online (Sandbox Code Playgroud)

我怎样才能让这些功能正常工作?


安装的 postgresql 包

jiw*_*ene 7

您必须使用 SQL 启用它:

CREATE EXTENSION pgcrypto;
Run Code Online (Sandbox Code Playgroud)

您必须在每个使用pgcrypto 函数的数据库上执行此操作