O2 Extension Installation

O2 is a PostgreSQL extension that improves user convenience by providing an interface that is compatible with functions/packages/types supported by Oracle in the PostgreSQL environment.

System requirements

Follows the operating system/hardware specifications supported by OpenSQL.


Overview

O2 Extension offers two installation methods for installing the product, including

  • Install with the make method

  • Install with the shell method

O2 installation file directory structure

The O2 installation file collection directory, which will be enclosed inside the OpenSQL installation package, is in the following format. Inside, there are two installation files (Makefile and install.sh).

ls -rlta

total 60
drwxr-xr-x  2 root root 4096 Mar 13 05:09 utl_file
drwxr-xr-x  2 root root 4096 Mar 13 05:09 o2views
drwxr-xr-x  2 root root 4096 Mar 13 05:09 o2types
drwxr-xr-x  2 root root 4096 Mar 13 05:09 o2functions
-rw-r--r--  1 root root 3266 Mar 13 05:09 install.sh        # script for sh installation 
drwxr-xr-x  2 root root 4096 Mar 13 05:09 dbms_sql
drwxr-xr-x  2 root root 4096 Mar 13 05:09 dbms_random
drwxr-xr-x  2 root root 4096 Mar 13 05:09 dbms_pipe
drwxr-xr-x  2 root root 4096 Mar 13 05:09 dbms_output
drwxr-xr-x  2 root root 4096 Mar 13 05:09 dbms_alert
-rw-r--r--  1 root root 1465 Mar 13 05:09 VERSION.json      # o2 extensions ver. information
-rw-r--r--  1 root root  672 Mar 13 05:09 Makefile          # Installation file for the make method
drwxr-xr-x 12 root root 4096 Mar 13 05:09 .
drwxr-xr-x  6 root root 4096 Mar 13 05:09 ..

Installation with make method

On Linux platforms with PostgreSQL installed, the O2 Extension can be installed automatically via the make command.

There are two types of installations: a full installation, which installs all extensions that include the O2 Extension at the same time, and individual installations, which install individual extensions.

Pre-installation requirements

PostgreSQL must be installed and the make and pg_config commands must be available on the terminal command line.

Full installation

Navigate to the directory where the O2 Extension installation components are gathered (the directory where the Makefile is located) and execute the make command below.

Individual installations

A individual installation is done by adding the name of the extension you want to install as an argument to the make command.

List of individual installation extension names

  • DBMS_ALERT

  • DBMS_OUTPUT

  • DBMS_PIPE

  • DBMS_RANDOM

  • DBMS_SQL

  • UTL_FILE

  • O2Functions

  • O2Types

  • O2Views


Installation with shell method

In environments where the make command is not available, you can install manually using a shell script.

You can install the O2 Extension manually on Linux platforms with PostgreSQL installed. You can install the O2 Extension in two ways: a full installation, which installs all the extensions that the O2 Extension includes at the same time, or an individual installation, which installs the individual extensions.

Pre-installation requirements

PostgreSQL must be installed and the pg_config binary must be available on the terminal command line.

Full installation

Execute the install.sh script included in the directory (o2) where the O2 Extension installation components are located.

Individual installation

A individual installation is done by adding the name of the extension you want to install as an argument to the make command.

List of individual installation extension names

  • DBMS_ALERT

  • DBMS_OUTPUT

  • DBMS_PIPE

  • DBMS_RANDOM

  • DBMS_SQL

  • UTL_FILE

  • O2Functions

  • O2Types

  • O2Views


Precaution with installation

Configuration of pg_config and $PATH

Both make/shell installation methods require that you perform the installation with an account where pg_config is available. Verify that the value of the $PATH variable contains /usr/pgsql-{PGversion}/bin .

Method to install from a user account without PGpath set in the $PATH value

You will need to bypass the $PATH and proceed with the installation as the user with the set permissions. Execute the following commands with sudo privileges.


Installation components

Extension type

O2 extensions are categorized into four main groups as follows: The sublists within each group list the names of the individual extensions that are actually available.

  • Types Extension

    • O2Types

  • Views Extension

    • O2Views

  • Functions Extension

    • O2Functions

  • Package Extensions

    • DBMS_ALERT

    • DBMS_OUTPUT

    • DBMS_PIPE

    • DBMS_RANDOM

    • DBMS_SQL

    • UTL_FILE

Extension components

Each extension consists of the following files, which can be created separately for each extension.

Ex) The configuration file for the O2Functions Extension is shown below.

  • Shared object file (eg. o2functions.so)

  • Control file (eg. o2functions.control)

  • Script file (eg. o2functions—1.0.sql, o2functions—1.0—1.1.sql, …)

And there's a VERSION.json file that organizes the version information for extensions into one place.

Activate O2 Extension

To activate the O2 Extension after installing it, you need to execute the SQL command like below.

The WITH SCHEMA clause allows you to specify the schema in which the objects defined by the extension will be created; otherwise, the default schema specified in the extension's control file will be used.

However, it is not available to specify the default schema for Package Extension (DBMS_ALERT, DBMS_PIPE, etc.).


Update O2 Extension

To update the O2 Extension to a higher version, you need to execute the SQL command like below.


Precautions for HA configuration

In HA configurations, you must manually attach to each node to install and update the O2 Extension. Ensure that the O2 Extension version installed on each node matches.

When a version difference occurs between nodes, the difference in behavior between versions causes a difference in which node the query was sent to when it was performed.

Last updated