Skip to contents

Drop a row level security policy

Usage

rls_drop_policy(con, policy = NULL, name = NULL, table = NULL)

Arguments

con

a DBI database connection object

policy

(list) a policy derived from rls_construct_policy()

name

(character) a policy name. optional

table

(character) a table name. optional

Value

a scalar numeric that specifies the number of rows affected by the statement, invisibly

Details

If policy is supplied, name and table are not required. If policy is not supplied, name and table need to be supplied.

Examples

if (FALSE) { # interactive() && has_postgres()
library(DBI)
library(RPostgres)
con <- dbConnect(Postgres())

dbCreateTable(con, "atable", mtcars)

policy1 <- rls_construct_policy(
  name = "hide_confidential",
  on = "atable",
  using = "(true)"
)
policy1
rls_create_policy(con, policy1)
rls_policies(con)
rls_drop_policy(con, policy1)
rls_policies(con)

dbDisconnect(con)
}