Skip to content

pg_procfs

displays /proc data from SQL

pg_procfs · displays /proc data from SQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
101596pg_procfspg_procfs0.0.1STATPostgreSQLC

Usage

Sources:

pg_procfs — PostgreSQL extension to display /proc FS data from SQL. Use it when collecting or interpreting the corresponding PostgreSQL statistics. Use the pinned upstream revision linked above as the API boundary and test it on the target PostgreSQL build.

Core Workflow

CREATE EXTENSION pg_procfs;

select * from pg_procfs('/proc/version');
 line |                                                                                     message

------+--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------
    0 | Linux version 4.18.0-372.19.1.el8_6.x86_64 (mockbuild@49c5e54ed716424c9ae8c1a3d1fef96f) (gcc version 8.5.0 20210514 (Red Hat 8.5.0-10
) (GCC)) #1 SMP Tue Aug 2 13:42:59 EDT 2022
(1 row)

Install the extension in the intended database, run the smallest upstream example above when available, and verify the installed version and returned values before integrating it into application SQL.

Important Objects

  • pg_procfs(IN filename cstring, OUT line integer, OUT data text) is an extension function and returns SETOF record.

Requirements and Caveats

  • The reviewed control file declares default version 0.0.1.
  • The control file marks the extension as non-relocatable.
  • Confirm privileges, supported PostgreSQL versions, upgrade behavior, and failure cases against the pinned source before production use.

Table reader