Syntax
── LIST PERMISSIONS ───────┬───────────────────────────────────┬──┬───────────►
│ ┌◄───── , ──────┐ │ │
└─ FOR ──────┬─┴──<usercode>───┴───┘ │
└─ PUBLIC ───────────────┘
Explanation
The LIST PERMISSIONS command allows you to view permissions defined in the database. The owner of the database can see all users and their assigned permissions; other users can only see the permissions that have been assigned to them and the permissions that they have assigned to others.
If LIST PERMISSIONS is issued with no usercode specified by a user that is not the owner of the database, only the permissions of the user issuing the command are returned. If the owner of the database issues the LIST PERMISSIONS command with no usercode specified, all permissions for all users are returned.
The LIST PERMISSIONS command returns an empty result set if:
-
You specify a user who is not assigned any permissions.
-
You are not the owner of the database and you specify a user who you did not initially grant permissions to.
Restrictions
The LIST PERMISSIONS command has the following restrictions:
-
The LIST PERMISSIONS command cannot exceed 65535 characters.
-
The LIST PERMISSIONS command can only display the first 20,000 permission rows; exceeding this amount might return an error.
-
The PUBLIC usercode and usercodes named using the <usercode> element cannot be used in the same statement.
-
Usercodes are not verified against valid system usercodes.
Examples
Example 1
The following example lists all permissions for the current user:
LIST PERMISSIONS
Example 2
The following example lists all permissions that have been granted to PUBLIC:
LIST PERMISSIONS FOR PUBLIC
Example 3
The following example lists permissions for USER1 and USER2:
LIST PERMISSIONS FOR USER1, USER2
Example 4
The following example illustrates the output of the LIST PERMISSIONS command in the Analyze Query response window:
GRANTOR GRANTEE OWNER TABLE INSERT DELETE UPDATE SELECT OWNER1 USER2 DB1 CUST Y Y Y Y ADMIN1 USER1 DB1 ORDERS Y N N Y OWNER1 ADMIN1 DB1 * G Y Y G OWNER1 PUBLIC DB1 PRODUCTS N N N Y OWNER1 OWNER1 DB1 * G G G G
In this example, the
-
GRANTOR is the user who granted the permission to another user.
-
GRANTEE is the user with the specified permission(s).
-
OWNER defines the hierarchical owner of the structures of the database, which is the database name.
-
TABLE is the name of the table or view with the permission.
The * (asterisk) implies all tables of the database.
-
Four privileges (INSERT, DELETE, UPDATE, SELECT) have a value of N, Y, or G. These values are defined, as follows:
-
N – The user does not have the privilege to perform the action.
-
Y – The user has the privilege to perform the action.
-
G – The user has the privilege to perform the action and can grant the same permission to other users.
-

