Hot answers tagged


It's an external module for Postgres. You should install the postgresql-contrib-8.4 (or your pg version) package via apt: apt-get install postgresql-contrib-8.4 Then you find the sql install file somewhere in the /usr/share/postgresql folder, and you'll need to run pgcryto.sql on the database. psql -d <database> -f /usr/share/postgresql/8.4/contrib/...


Note that I'm working on Ubuntu 12.04, which uses postgresql 9.1. There, I needed to: sudo apt-get install postgresql-contrib And then in my database: postgres@ztrustee:~$ psql test psql (9.1.3) Type "help" for help. test=# CREATE EXTENSION pgcrypto; CREATE EXTENSION And now I can use pgcrypto functionality, gen_random_bytes(): test=# create table ...


Depending on the full error message you receive (I have a hunch you didn't post it in full) you probably are trying to run the script by using a login role which is not superuser: C:\Users\Administrator>c:\PostgreSQL\9.0\bin\psql.exe -U milen -f C:\PostgreSQL\9.0\share\contrib\pgcrypto.sql milen SET psql:C:/PostgreSQL/9.0/share/contrib/pgcrypto.sql:9: ...


As dezso said in the comment, the problem was that CREATE can't be part of a subquery. And phpPgAdmin transform the query before executing it so it had put the CREATE as a subquery. So the solution was to execute the CREATE query in PgAdmin for example.

Only top voted, non community-wiki answers of a minimum length are eligible