Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to install pgcrypto in Windows. I have a file C:\Program\PostgreSQL\9.0\share\contrib\pgcrypto.sql but when I try to run it in psql I get an error:

C:: Permission denied

How do I solve this?

share|improve this question
Can you confirm that the file exists at C:\Program\PostgreSQL\9.0\share\pgcrypto.sql and not at C:\Program Files\PostgreSQL\9.0\share\pgcrypto.sql for example? – Jack Douglas Jun 13 '11 at 13:39
@Jack: Yes, it's the 64-bit version. I have C:\Program\PostgreSQL\9.0\lib\pgcrypto.dll and C:\Program\PostgreSQL\9.0\share\contrib\pgcrypto.sql – Jonas Jun 13 '11 at 13:42
I get the same error even if I start the psql command prompt as Administrator. – Jonas Jun 13 '11 at 13:43
Can you copy and paste the script line by line into an interactive pg shell and see where you get the error? Or perhaps try it with pgAdmin? Also have you verified the ability to run psql in interactive mode? – Justin Dearing Jun 13 '11 at 16:05
Have you set the whole postgres(not just /bin but everything) directory to be accessible by everyone (or the correct user)? I had the problem once that the access rules were wrong by default. – DrColossos Jun 13 '11 at 16:52

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
psql:C:/PostgreSQL/9.0/share/contrib/pgcrypto.sql:9: ERROR:  permission denied for language c
psql:C:/PostgreSQL/9.0/share/contrib/pgcrypto.sql:14: ERROR:  permission denied for language c
psql:C:/PostgreSQL/9.0/share/contrib/pgcrypto.sql:19: ERROR:  permission denied for language c
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.