↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Documentation / Storage Parameters / View options

security_barrier

security_barrier

This should be used if the view is intended to provide row-level security. See Section 39.5 for full details.

Reading PostgreSQL 18.6.

Description

This should be used if the view is intended to provide row-level security. See Section 39.5 for full details.

Applies to
View options
Value type
boolean

Usage

WITH (security_barrier = value)

View options

Views do not store query results. Set these security or update semantics with CREATE VIEW WITH or ALTER VIEW.

Security semantics

If an automatically updatable view is marked with the security_barrier property then all the view's WHERE conditions (and any conditions using operators which are marked as LEAKPROOF ) will always be evaluated before any conditions that a user of the view has added. See Section 39.5 for full details. Note that, due to this, rows which are not ultimately returned (because they do not pass the user's WHERE conditions) may still end up being locked. EXPLAIN can be used to see which conditions are applied at the relation level (and therefore do not lock rows) and which are not.

Related entries

Documentation and source

Source build
Version
18.6
Build
Local English manual 18.6
Source fingerprint
eb6c2292fdf28e1b4635ab478eec3919411cdf4a6c07553387870e26201f3744

Related entries

Back to Storage Parameters · Recorded in PostgreSQL 10 through 20; the first sample is not necessarily its introduction.