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?

  • 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? Jun 13, 2011 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, 2011 at 13:42
  • I get the same error even if I start the psql command prompt as Administrator.
    – Jonas
    Jun 13, 2011 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? Jun 13, 2011 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, 2011 at 16:52

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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