PostgresPolicyCatalogNormalizer
Uses PostgreSQL's own parser to compare desired RLS predicates with catalog predicates. Temporary views are dropped in the same session and never alter application schema. Implements [RLS-DIFF].
public static class PostgresPolicyCatalogNormalizer
Methods
Inspect(NpgsqlConnection)
public static Result<SchemaDefinition, MigrationError> Inspect(NpgsqlConnection connection)
Inspect the live schema with policy predicates in the same view context used for desired predicates. Implements [RLS-DIFF] and issue #119. PostgreSQL 15 qualifies view columns differently from pg_policies; normalizing both preserves correlated references and subquery shadowing.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
NpgsqlConnection |
Returns: MigrationError>
Normalize(NpgsqlConnection, SchemaDefinition, SchemaDefinition)
public static Result<SchemaDefinition, MigrationError> Normalize(NpgsqlConnection connection, SchemaDefinition live, SchemaDefinition desired)
Canonicalize policies on tables that already exist.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
NpgsqlConnection |
|
live |
SchemaDefinition |
|
desired |
SchemaDefinition |
Returns: MigrationError>