Installing Cryptographic Functions for PostgreSQL (pgcrypto)

pgcrypto is available as a package that you can download from the Pivotal Network and install using the Package Manager utility (gppkg). gppkg installs pgcrypto and other HAWQ extensions, along with any dependencies, on all hosts across a cluster.


Before you install the pgcrypto software package, make sure that your HAWQ database is running, you have sourced and that the $GPHOME environment variable is set.

Install pgcrypto

  1. Download the HDB Language Extensions tar.gz file from the Pivotal Network, and extract its contents.
  2. Copy the pgcrypto package file to the HAWQ master host.
  3. On HAWQ master, install the software package by running the following command:

    $ gppkg -i pgcrypto-x.x.x.x-x86_64.gppkg

    where x.x.x.x corresponds to the version of pgcrypto you are installing. For example:

    $ gppkg -i pgcrypto-

    You will see output similar to the following.

    20160523:21:34:55:055257 gppkg:ip-10-32-36-69:gpadmin-[INFO]:-Starting gppkg with args: -i /tmp/pgcrypto-
    20160523:21:34:56:055257 gppkg:ip-10-32-36-69:gpadmin-[INFO]:-Installing package pgcrypto-
    Installed GPDB Version: pg_ctl (HAWQ) build 22455
    20160523:21:34:56:055257 gppkg:ip-10-32-36-69:gpadmin-[INFO]:-Validating rpm installation cmdStr='rpm --test --nodeps -i /usr/local/hawq- --dbpath /usr/local/hawq- --prefix /usr/local/hawq-'
    20160523:21:34:59:055257 gppkg:ip-10-32-36-69:gpadmin-[INFO]:-Installing pgcrypto- locally
    Installed GPDB Version: pg_ctl (HAWQ) build 22455
    20160523:21:35:00:055257 gppkg:ip-10-32-36-69:gpadmin-[INFO]:-Validating rpm installation cmdStr='rpm --test --nodeps -i /usr/local/hawq- --dbpath /usr/local/hawq- --prefix /usr/local/hawq-'
    20160523:21:35:00:055257 gppkg:ip-10-32-36-69:gpadmin-[INFO]:-Installing rpms cmdStr='rpm -i --nodeps /usr/local/hawq- --dbpath /usr/local/hawq- --prefix=/usr/local/hawq-'
    20160523:21:35:00:055257 gppkg:ip-10-32-36-69:gpadmin-[INFO]:-Completed local installation of pgcrypto-
    20160523:21:35:01:055257 gppkg:ip-10-32-36-69:gpadmin-[INFO]:-Please run psql -d mydatabase -f $GPHOME/share/postgresql/contrib/pgcrypto.sql to enable the package.
    20160523:21:35:01:055257 gppkg:ip-10-32-36-69:gpadmin-[INFO]:-pgcrypto- successfully installed.
  4. On every database where you want to enable pgcrypto, run the following command:

    $ psql -d <dbname> -f $GPHOME/share/postgresql/contrib/pgcrypto.sql

    Replace <dbname> with the name of the target database.

Uninstall pgcrypto

To uninstall the pgcrypto objects from your database, use uninstall_pgcrypto.sql. This script removes pgcrypto objects.

On each database where you enabled pgcrypto support, execute the following:

$ psql -d <dbname> -f $GPHOME/share/postgresql/contrib/uninstall_pgcrypto.sql

Replace <dbname> with the name of the target database.

Note: This script does not remove dependent user-created objects.

Uninstall the pgcrypto Package

You can uninstall the pgcrypto software using the Package Manager (gppkg), as follows:

$ gppkg -r pgcrypto