plpgsql_check

Website

https://github.com/okbob/plpgsql_check/

Description

plpgsql_check is a PostgreSQL extension with functionality for direct or indirect extra validation of functions in PL/pgSQL language. It verifies a validity of SQL identifiers used in PL/pgSQL code. It also tries to identify performance issues.

Package naming convention

The PostgreSQL RPM repository uses PostgreSQL version numbers in the RPM packages. For example plpgsql_check for PostgreSQL 18 is named as plpgsql_check_18. Similarly plpgsql_check for PostgreSQL 17 is named as plpgsql_check_17.

Subpackages

plpgsql_check provides the following subpackages:

  • llvmjit: Provides just-in-time compilation support for plpgsql_check

Package specifications and repository requirements

PostgreSQL PGDG RPM repository

Install PGDG repository from: https://zypp.postgresql.org/repopackages/

Installation

OS Command
SuSE Enterprise Linux 15 / 16, OpenSuSE Leap 16.0 zypper install plpgsql_check_18 (or change the version as described above)

Post-installation

plpgsql_check has two modes:

  • Active mode: Recommended for production usage.
  • Passive mode: Recommended for dev or pre prod environments. In this mode PL/pgSQL functions can be checked upon execution and requires plpgsql_check to be added to shared_preload_libraries before creating the extension. This requires a restart of the PostgreSQL instance to take effect. If there are additional libraries, please be sure to add them as a comma-separated list. An example is:
    shared_preload_libraries="plpgsql_check"

    Alternatively you can load the extension in individual session(s) by:

    • LOAD 'plpgsql_check'
    • SET plpgsql_check.mode='every_start';

Additional GUC

You can use the following GUC to manage this extension. Please refer to the extension documentation for details:

  • plpgsql_check.mode # (enum) Default mode is by_function, that means that the enhanced check is done only in active mode - by calling the plpgsql_check_function. fresh_start means cold start (first the function is called). Possible values: disabled, by_function, fresh_start, every_start
  • plpgsql_check.fatal_errors # (boolean) Default: on
  • plpgsql_check.show_nonperformance_extra_warnings # (boolean) Default: off
  • plpgsql_check.show_nonperformance_warnings # (boolean) Default: off
  • plpgsql_check.show_performance_warnings # (boolean) Default: off

Creating the extension

Connect to the database that you want to create the extension as superuser and run:
CREATE EXTENSION plpgsql_check;

Available packages

PostgreSQL version(s) OS version Arch Status
18,17,16,15,14 SuSE Enterprise Linux 16 x86_64 Available
18,17,16,15,14 OpenSuSE Leap 16.0 x86_64 Available
18,17,16,15,14 SuSE Enterprise Linux 15 x86_64 Available