Skip to main content

Installing on PostgreSQL

How to install the TDP UDF on a PostgreSQL server. The installer copies the library and extension files into place and creates the tdp extension for you.

Check the Prerequisites first if you haven't already.


1. Extract the Installer Package​

Extract the installer file, then go into the folder it creates:

tar -xzf tdp-udf.tar.gz

2. Run the Installer​

Give the installer permission to run, then start it with the PostgreSQL version you use:

chmod +x installer.sh
sudo ./installer.sh <POSTGRESQL_VERSION>

Enter the server password when you're asked for it.


3. What the Installer Does​

The installer runs through these steps on its own:

  • Detects the PostgreSQL installation folder.
  • Copies libtdp.so into the PostgreSQL library folder.
  • Copies tdp.control and tdp--1.0.sql into the PostgreSQL extension folder.
  • Restarts the PostgreSQL service.
  • Removes the old extension, if there is one.
  • Creates the tdp extension.
  • Verifies the result.
note

Before creating the extension, the installer runs DROP EXTENSION IF EXISTS tdp CASCADE. That's what makes it safe to run again for a reinstall.

warning

The installer restarts the PostgreSQL service, so connections to the database are interrupted while it runs. Because the old extension is dropped with CASCADE, anything in the database that depends on it is dropped too.


4. Expected Result​

When the installation succeeds, you'll see output along these lines:

  • libtdp.so was copied to the PostgreSQL library folder.
  • tdp.control and tdp--1.0.sql were copied to the PostgreSQL extension folder.
  • The tdp extension was created.
  • 11 TDP functions are registered in PostgreSQL.

5. Verify the Installation​

Log in to PostgreSQL and run:

SELECT proname FROM pg_proc WHERE proname LIKE 'tdp_%' ORDER BY proname;

You should see 11 TDP functions in the result.


6. Enable the Extension on Another Database​

The extension is only active in the database where CREATE EXTENSION was run. To use TDB in a different database, run:

sudo -u postgres psql -d <DATABASE_NAME> -c "CREATE EXTENSION IF NOT EXISTS tdp;"

Next, connect the database to TAKAKRYPT and try the functions: Connecting and Testing.