NAME

DBIO::PostgreSQL::Introspect::Policies - Introspect PostgreSQL Row Level Security policies

VERSION

version 0.900007

DESCRIPTION

Fetches Row Level Security policy metadata from pg_catalog.pg_policy. Policy command types and USING/WITH CHECK expressions are decoded from PostgreSQL's internal representation. Tables an installed extension owns are left out by DBIO::PostgreSQL::Introspect::Tables, and their policies with them.

METHODS

fetch

my $policies = DBIO::PostgreSQL::Introspect::Policies->fetch($dbh, $filter);

Returns a hashref keyed by schema.table. Each value is a hashref keyed by policy name. Each policy entry has: schema_name and table_name (the table it is on, each name for itself -- the key cannot be taken apart again), policy_name, command (SELECT, INSERT, UPDATE, DELETE, or ALL), permissive, using_expr, check_expr, roles (ArrayRef of role names, or undef for all roles), depends_on_columns.

depends_on_columns is the columns the policy's expressions read: a HashRef from the key of a relation to an ArrayRef of column names, sorted, from the pg_depend rows of the policy ("column_reads" in DBIO::PostgreSQL::Introspect). It is empty for a policy that reads no column (USING (true)). PostgreSQL does not alter the type of a column such a policy reads (cannot alter type of a column used in a policy definition); DBIO::PostgreSQL::Diff::Column asks it before it changes one.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.