Postgres pgcrypto privliledges
Asked Answered
I

1

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.

Ignazio answered 14/9, 2015 at 0:49 Comment(2)
You're sure you logged in to the same database? Extensions are per database.Llamas
lol. Silly mistake. That was the problem. Add that as an answer if you would, and, I can mark it correctly for others.Ignazio
L
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.

Llamas answered 14/9, 2015 at 1:0 Comment(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.Slavophile

© 2022 - 2024 — McMap. All rights reserved.