<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Row-Level Security on Postgres Scripts</title><link>https://www.postgresscripts.com/tags/row-level-security/</link><description>Recent content in Row-Level Security on Postgres Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>PostgresScripts.com</copyright><lastBuildDate>Mon, 31 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.postgresscripts.com/tags/row-level-security/index.xml" rel="self" type="application/rss+xml"/><item><title>Audit Row-Level Security Policies with pg_policies</title><link>https://www.postgresscripts.com/post/audit-row-level-security-policies-pg-policies/</link><pubDate>Mon, 31 Aug 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/audit-row-level-security-policies-pg-policies/</guid><description>
&lt;h2 id="audit-row-level-security-policies-with-pg_policies"&gt;Audit Row-Level Security Policies with pg_policies&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.postgresql.org/docs/current/view-pg-policies.html"&gt;pg_policies&lt;/a&gt;&lt;/strong&gt; turns a table's row-level security setup — however many &lt;code&gt;CREATE POLICY&lt;/code&gt; statements are scattered across migration files — into one queryable inventory: one row per policy, with the roles it binds to, the command it governs, and the boolean expressions doing the actual filtering. A &lt;code&gt;\d&lt;/code&gt; on the table shows that a policy exists; it does not show whether that policy is permissive or restrictive, which roles it actually applies to, or what its &lt;code&gt;USING&lt;/code&gt; clause evaluates to at runtime. That gap between &amp;quot;a policy is attached&amp;quot; and &amp;quot;here is exactly what the policy does&amp;quot; is what an audit needs closed before trusting row-level security in production.&lt;/p&gt;</description></item></channel></rss>