GRANT (Truncate)

Grants TRUNCATE TABLE privileges to non-owners of a table. It also grants the non-owner of the table the following partition functions:

Syntax

GRANT TRUNCATE
... | ALL [ PRIVILEGES ] }
... ON SCHEMA schema[,...]
... ON [table‑name] to { username | role | PUBLIC } 
... [ WITH GRANT OPTION ]
... [ WITH ADMIN OPTION ]

Parameters

ALL

Applies to all privileges.

PRIVILEGES

Included for SQL standard compatibility and is ignored.

[db-name.]

[Optional] Specifies the current database name to which you are connected.

schema

Identifies the schema to which you are granting privileges.

table‑name The table to which truncate privileges are granted.
username

Grants the privilege to a specific user.

role

Grants the privilege to a specific role.

PUBLIC

Grants the privilege to all users.

WITH GRANT OPTION

Allows the recipient of the privilege to grant it to other users.

WITH ADMIN OPTION
Allows roles, and associated users, the ability to grant this privilege to other users.

Examples

These examples show the various ways you can grant truncate privileges to a user using GRANT TRUNCATE.

Grant truncate privileges on table t1 to user u1:

=> GRANT TRUNCATE ON t1 to u1;

Grant truncate privileges on table t1 to role r1;

=> GRANT TRUNCATE ON t1 to r1;

Grant truncate privileges to a user using the WITH GRANT OPTION parameter that allows the user to grant truncate privileges to other users:

=> GRANT TRUNCATE ON t1 to u1 WITH GRANT OPTION;

Grant truncate privileges on one table to multiple users:

=> GRANT TRUNCATE ON t1 to u1, u2, r1;

Grant truncate privileges on multiple tables to multiple users:

=> GRANT TRUNCATE ON t1, t2 to u1, u2, r1;