I'm in the process of creating a postgres database for production in CentOS 7. So I already installed (yum install postgresql10-server postgresql10 after adding the repos of course) and configured postgres 10. However, in my scripts I need to install pgcrypto extension and I haven't successfully install it. This is what I've done so far:
- the first error I got was saying that the
/usr/pgsql-10/share/extension/pgcrypto.control
files does not exist. Googling I realized that I have to installpostgres-contrib
package, which I did and then restarted postgres service, but the error continues due to the fact that the extensions were installed into/usr/share/pgsql/extension
, so I copied the extension files from they were installed to they were expected and then -
appears this message
"ERROR: could not access file "$libdir/pgcrypto": No such file or directory"
Googling again I found that maybe I need to give another option, so I ran
CREATE EXTENSION pgcrypto FROM unpackaged;
then -
the error message now is
ERROR: function digest(text, text) does not exist
And I'm stuck and without any idea what to do next. Is anybody else using this extension in postgres 10 on Linux?, if so, how did you create the extension?
Version info: PostgreSQL 10.1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16), 64-bit
Best Answer
From the docs on
CREATE EXTENSION
You need to check what
SHAREDIR
is set to withpg_config --sharedir
. If that's not set to/usr/share/pgsql/extension
then likely yourpostgresql-contrib
was packaged by someone different than your copy of postgresql. These are compile time variables and they should be the same. Moving them in likely won't work either because if these are packaged by two separate entities they're likely built against different libraries.CentOS
In your case I assume
What you probably want to do is install from the CentOS repos. Uninstall all things related to PostgreSQL, and delete those files you copied or linked and run this