7

I intsalled the pgcrypto extension as the superuser like this:

CREATE EXTENSION pgcrypto;

As the superuser, I tested it, and it works find:

select gen_salt('bf');
           gen_salt
-------------------------------
 $2a$06$CJPcLcOBZnCEl.Z5ChrSbO

But, when logging in as a different user, I get an error as follows:

select gen_salt('bf');
ERROR:  function gen_salt(unknown) does not exist

How do I make the pgcrypto library visible to all users?

Thanks.

Doo Dah
  • 3,979
  • 13
  • 55
  • 74

1 Answers1

15

PostgreSQL extensions are per database. If you log in to another database, the extension is not available there. By default the functions are usable by any user.

Sami Kuhmonen
  • 30,146
  • 9
  • 61
  • 74
  • 1
    For those who are wondering of how to enable extensions, in the left pane of pgAdmin, expand the _Databases_ rollout -> right click on extensions -> select _Create_ -> select _Extension_ -> in the _Name_ field, select your preferred extension name (e.g. `pgcrypto`) -> click _Save_. – Romeo Sierra Feb 05 '20 at 02:37