Skip to content

Policies Operations

Operation: createPolicy

pgm.createPolicy( tableName, policyName, options )

IMPORTANT

Create a new policy - postgres docs

Arguments

NameTypeDescription
tableNameNamename of the table to alter
policyNamestringname of the new policy
optionsobjectCheck below for available options

Options

OptionTypeDescription
commandstringALL, SELECT, INSERT, UPDATE, or DELETE
rolestring or arraythe role(s) to which the policy is to be applied
usingstringSQL conditional expression for visibility check
checkstringSQL conditional expression for insert/update check

Reverse Operation: dropPolicy

pgm.dropPolicy( tableName, policyName, options )

IMPORTANT

Drop a policy - postgres docs

Arguments

NameTypeDescription
tableNameNamename of the table where the policy is
policyNamestringname of the policy to delete
optionsobjectCheck below for available options

Options

OptionTypeDescription
ifExistsbooleandrops policy only if it exists

Operation: alterPolicy

pgm.alterPolicy( tableName, policyName, options )

IMPORTANT

Alter a policy - postgres docs

Arguments

NameTypeDescription
tableNameNamename of the table where the policy is
policyNamestringname of the policy to alter
optionsobjectCheck below for available options

Options

OptionTypeDescription
rolestringthe role(s) to which the policy is to be applied
usingstringSQL conditional expression for visibility check
checkstringSQL conditional expression for insert/update check

Operation: renamePolicy

pgm.renamePolicy( tableName, policyName, newPolicyName )

IMPORTANT

Rename a policy - postgres docs

Arguments

NameTypeDescription
tableNameNamename of the table where the policy is
policyNamestringold name of the policy
newPolicyNamestringnew name of the policy