postgresqldebianpostgresql-9.6cryptdebian-stretch

postgresql – No crypt function on Debian stretch


I have PostgreSQL 9.6 installation on my Debian Stretch (9). When I want to use crypt() or gen_salt() functions, it says:

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.

How can I get these functions working?


Installed postgresql packages


Solution

  • You have to enable it using SQL:

    CREATE EXTENSION IF NOT EXISTS pgcrypto;
    

    You have to do it on each database that uses pgcrypto functions.