noset

Module for blocking SET variables for non-super users.

Overview

PackageVersionCategoryLicenseLanguage
pg_noset0.3.0SECAGPL-3.0C
IDExtensionBinLibLoadCreateTrustRelocSchema
7420nosetNoYesYesYesNoYes-
Relatedpg_readonly pg_permissions set_user pgaudit login_hook sepgsql safeupdate credcheck

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY0.3.01817161514pg_noset-
RPMPIGSTY0.3.01817161514noset_$v-
DEBPIGSTY0.3.01817161514postgresql-$v-noset-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
d12.aarch64
d13.x86_64
d13.aarch64
u22.x86_64
u22.aarch64
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
u24.x86_64
u24.aarch64
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0

Build

You can build the RPM / DEB packages for pg_noset using pig build:

pig build pkg pg_noset         # build RPM / DEB packages

Install

You can install pg_noset directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

pig repo add pgsql -u          # Add repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install pg_noset;          # Install for current active PG version
pig ext install -y pg_noset -v 18  # PG 18
pig ext install -y pg_noset -v 17  # PG 17
pig ext install -y pg_noset -v 16  # PG 16
pig ext install -y pg_noset -v 15  # PG 15
pig ext install -y pg_noset -v 14  # PG 14
dnf install -y noset_18       # PG 18
dnf install -y noset_17       # PG 17
dnf install -y noset_16       # PG 16
dnf install -y noset_15       # PG 15
dnf install -y noset_14       # PG 14
apt install -y postgresql-18-noset   # PG 18
apt install -y postgresql-17-noset   # PG 17
apt install -y postgresql-16-noset   # PG 16
apt install -y postgresql-15-noset   # PG 15
apt install -y postgresql-14-noset   # PG 14

Preload:

shared_preload_libraries = 'noset';

Create Extension:

CREATE EXTENSION noset;

Usage

noset: Prevent users from changing session parameters via SET/RESET

noset is a loadable module that prevents specific users from using SET or RESET commands to change session parameters.

CREATE EXTENSION noset;

Configuration

Add to postgresql.conf:

shared_preload_libraries = 'noset'

GUC Parameters

ParameterDefaultDescription
noset.enabledfalseEnable SET/RESET blocking for the role
noset.parameters*Parameters to block (comma-separated, * = all)

Setting Up Per-User Restrictions

-- Block ALL SET/RESET for a user
ALTER USER appuser SET noset.enabled = true;

-- Block only specific parameters
ALTER USER appuser SET noset.enabled = true;
ALTER USER appuser SET noset.parameters = 'work_mem,jit';

Example

-- As appuser:
SET work_mem = '1GB';
-- ERROR: permission denied to set/reset parameter 'set work_mem = '1GB';'

SET maintenance_work_mem = '1GB';
-- SET (allowed, not in blocked list)

Finding Restricted Users

SELECT usename, useconfig FROM pg_user
WHERE useconfig IS NOT NULL
  AND array['noset.enabled=on'] <@ useconfig;

Notes

  • Does not apply to superusers
  • The extension revokes access to the set_config function from PUBLIC

Last Modified 2026-03-12: add pg extension catalog (95749bf)