check_table_select_permissions

Function check_table_select_permissions 

Source
pub async fn check_table_select_permissions(
    client: &Client,
) -> Result<TablePermissionCheck>
Expand description

Check SELECT permission on all user tables in a database

Queries pg_tables to find all user tables (excluding pg_catalog and information_schema) and checks if current user has SELECT privilege.

§Arguments

  • client - Connected PostgreSQL client (must be connected to the target database)

§Returns

Returns TablePermissionCheck with lists of accessible and inaccessible tables.

§Errors

Returns an error if the permission query fails.

§Examples

let client = connect("postgresql://user:pass@localhost:5432/mydb").await?;
let perms = check_table_select_permissions(&client).await?;
if !perms.all_accessible() {
    println!("Cannot read {} tables", perms.inaccessible_count());
}