Skip to content

16.6.7 Feature Support by Privilege

Machbase privileges are divided into database privileges and table privileges by scope.

Database Privileges

Database privileges apply to the specified active database. Grant MOUNT on MACHBASEDB. Grant USAGE and table SELECT separately for access to mounted databases.

PrivilegeAllowed OperationsGranted by Default
CONNECTConnect to an active database, USE, and discover objectsO (MACHBASEDB compatibility)
CREATECreate tables, views, indexes, rollups, tablespaces, and retention policiesO
DROPDrop tables, views, indexes, rollups, tablespaces, and retention policiesO
ALTERChange table structure and execute ALTER SYSTEMX
BACKUPExecute BACKUP DATABASEX
MOUNTExecute MOUNT DATABASE / UMOUNT DATABASEX
USAGEDiscover objects in mounted databasesX
DDLCREATE + DROP (composite privilege)
ALLGrant CONNECT, CREATE, DROP, ALTER, and BACKUP together

“Granted by default: O” means compatibility defaults on MACHBASEDB for users created with CREATE USER. Grant privileges on other logical databases separately.

Table Privileges

Table privileges control DML on a specific table.

PrivilegeAllowed Operations
SELECTSELECT from the table
INSERTINSERT into the table
DELETEDELETE from the table
UPDATEUPDATE the table

GRANT / REVOKE Syntax

-- Grant database privileges
GRANT CONNECT ON DATABASE factory_a TO app_user;
GRANT CREATE ON DATABASE factory_a TO app_user;
GRANT BACKUP ON DATABASE factory_a TO backup_user;
GRANT ALL ON DATABASE factory_a TO admin_user;

-- Grant table privileges
GRANT SELECT ON sys.sensor_data TO reader_user;
GRANT INSERT ON sys.sensor_data TO writer_user;

-- Revoke privileges
REVOKE SELECT ON sys.sensor_data FROM reader_user;
REVOKE BACKUP ON DATABASE factory_a FROM backup_user;

Privileges for Common Operations

OperationPrivilege ScopeRequired Privilege
CREATE TABLEDatabaseCREATE
DROP TABLEDatabaseDROP
ALTER TABLEDatabaseALTER
BACKUP DATABASEDatabaseBACKUP
MOUNT DATABASEDatabaseMOUNT
Table SELECTTableSELECT
Table INSERTTableINSERT
Table UPDATETableUPDATE
Table DELETETableDELETE

Checking Privileges

-- List users
SELECT user_name, user_id FROM m$sys_users;

-- Query database privileges
SELECT * FROM m$sys_grant_databases WHERE grantee = 'APP_USER';

-- Query table privileges
SELECT * FROM m$sys_grant_tables WHERE grantee = 'APP_USER';

Detailed Reference

For the complete privilege model and examples, see Privilege Management.

Last updated on