PostgreSQL Multiple Instances

This guide outlines the procedures for identifying, deploying, and upgrading PostgreSQL database instances using integrated scanner mechanisms and automated workflows.

Scanner Process

For running the scans on all software versions, refer to BigFix Scanner for Middleware Application. These results are then used by the PostgreSQL patching tasks to determine which instances require updates.

Note: Before performing any patching activity, it is highly recommended to create a full backup of all custom configurations and environment-specific settings. This ensures that you can restore your data and configurations if required after the patching process.
Note: The detection mechanism identifies only source-code-based and zip-based installations. For more information, refer to the official PostgreSQL documentation.

Mandatory Pre-Patching Prerequisites

Before applying the patch, the following conditions must be met to ensure successful execution:
  • Service Downtime: PostgreSQL files cannot be updated while the database server is running. You must stop the Windows Service or the Linux daemon before patching.
  • Compilation Tools: For Linux, the environment requires gcc (or an equivalent C compiler), GNU make, readline (for psql command-line editing), and zlib (for compression support) to compile source code into executable binaries.
  • Third-Party Dependencies: For Linux, additional features enabled during initial configuration may require optional modules and packages like openssl, libxml2, libxslt, bison, and flex. Users must ensure all required dependency libraries are installed and accessible so the patching script can verify them.

Patching Process

The PostgreSQL patching task uses the scanner results to identify lower minor versions and update them to the patch version specified in the task.

  1. Select the applicable computer in the BigFix Console to review installed PostgreSQL versions.
  2. When the action is executed on the endpoint, the patching task reads the results.xml file and identifies all PostgreSQL instances present on the system.
  3. For each detected instance, distinct Makefiles are utilized or generated in the middleware/postgresql directory.
  4. For Windows: All outdated or lower versions of PostgreSQL are updated in a single execution. Verify that no background engine processes (postgres.exe) are running if the patching process fails.
  5. For Linux: The source code binaries of the patching version is downloaded and extracted in the middleware/postgresql directory.

The upgrade process follows a structured sequence to ensure minimal downtime and configuration integrity.

Building and Installing Binaries

The task involves executing the configuration prior to building the binaries.

For Linux: Users must compile and install the updated binaries by running the configure (with custom path and the build options), make, and make install commands from within the extracted folder middleware/postgresql/<version>. After a successful installation, the user needs to run make distclean. Repeat the above process for each of the detected instances (custom path) in the mw_results.xml file.
Note: If the configuration step fails, verify that all required compilation dependencies and development headers are installed and properly configured.

Exit codes and their meanings

When performing tasks such as patching or extracting files in PostgreSQL, certain exit codes may be returned to indicate the outcome of the operation. These codes help identify issues during the installation or update process.
Table 1. Exit codes and their meanings
Exit code Action
Exit Code 11: Patching of one or more instances failed
  • Run the discovery task again to retrieve the latest versions of the installed PostgreSQL instances.
  • Ensure that all instances are properly configured, all running services are stopped, and directories are accessible.
Exit Code 13: Archive file not found
  • Verify that the download link is correct and the file is accessible.
  • Ensure the source archive file exists at the specified location.
Exit Code 14: Extraction of the archive failed
  • Check if you have the necessary file extraction and directory write permissions.
  • Ensure that the destination extraction path is valid and has sufficient disk space.