pg_manage_rls
Enable, disable, or manage PostgreSQL Row-Level Security (RLS) policies. Perform operations like creating, editing, dropping, or retrieving policies for specific tables and roles with detailed control over conditions and permissions.
Instructions
Manage PostgreSQL Row-Level Security - enable/disable RLS and manage policies. Examples: operation="enable" with tableName="users", operation="create_policy" with tableName, policyName, using, check
Input Schema
Name | Required | Description | Default |
---|---|---|---|
check | No | WITH CHECK expression for policy (optional for create_policy/edit_policy) | |
command | No | Command the policy applies to (for create_policy) | |
connectionString | No | PostgreSQL connection string (optional) | |
ifExists | No | Include IF EXISTS clause (for drop_policy) | |
operation | Yes | Operation: enable/disable RLS, create_policy, edit_policy, drop_policy, get_policies | |
policyName | No | Policy name (required for create_policy/edit_policy/drop_policy) | |
replace | No | Whether to replace policy if exists (for create_policy) | |
role | No | Role the policy applies to (for create_policy) | |
roles | No | List of roles for policy (for edit_policy) | |
schema | No | Schema name (defaults to public) | |
tableName | No | Table name (required for enable/disable/create_policy/edit_policy/drop_policy, optional filter for get_policies) | |
using | No | USING expression for policy (required for create_policy, optional for edit_policy) |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"check": {
"description": "WITH CHECK expression for policy (optional for create_policy/edit_policy)",
"type": "string"
},
"command": {
"description": "Command the policy applies to (for create_policy)",
"enum": [
"ALL",
"SELECT",
"INSERT",
"UPDATE",
"DELETE"
],
"type": "string"
},
"connectionString": {
"description": "PostgreSQL connection string (optional)",
"type": "string"
},
"ifExists": {
"description": "Include IF EXISTS clause (for drop_policy)",
"type": "boolean"
},
"operation": {
"description": "Operation: enable/disable RLS, create_policy, edit_policy, drop_policy, get_policies",
"enum": [
"enable",
"disable",
"create_policy",
"edit_policy",
"drop_policy",
"get_policies"
],
"type": "string"
},
"policyName": {
"description": "Policy name (required for create_policy/edit_policy/drop_policy)",
"type": "string"
},
"replace": {
"description": "Whether to replace policy if exists (for create_policy)",
"type": "boolean"
},
"role": {
"description": "Role the policy applies to (for create_policy)",
"type": "string"
},
"roles": {
"description": "List of roles for policy (for edit_policy)",
"items": {
"type": "string"
},
"type": "array"
},
"schema": {
"description": "Schema name (defaults to public)",
"type": "string"
},
"tableName": {
"description": "Table name (required for enable/disable/create_policy/edit_policy/drop_policy, optional filter for get_policies)",
"type": "string"
},
"using": {
"description": "USING expression for policy (required for create_policy, optional for edit_policy)",
"type": "string"
}
},
"required": [
"operation"
],
"type": "object"
}