Informix Error -279: Cannot grant or revoke database privileges for table or view.
Cause and resolution
Cannot grant or revoke database privileges for table or view.
This statement names one or more of the database-level privileges (CONNECT, RESOURCE, and DBA), but it also uses the ON table-name clause. A statement that does not mention a particular table (does not contain the ON clause) must grant or revoke the database-level privileges. The table-level privileges such as INSERT require an ON clause. Do not mix the two kinds in the same statement.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-279 is a clear GRANT/REVOKE syntax rule: database-level privileges (CONNECT, RESOURCE,
DBA) and table-level privileges (SELECT, INSERT, UPDATE, DELETE, and similar) use
mutually exclusive syntax, and mixing them in one statement isn't allowed.
- A
GRANT/REVOKEnaming a database-level privilege while also including anON table-nameclause. Database-level privileges apply to the whole database, not to a specific table, so anONclause doesn't make sense with them. - Confusion between database-level and table-level privilege syntax — assuming every
GRANTneeds anONclause, or not realizingCONNECT/RESOURCE/DBAare a fundamentally different category from table privileges like -272/-273/-274/-275. - Attempting to mix a database-level privilege and a table-level privilege in the same statement — not permitted; they must be granted separately.
Solutions / Resolution
- For database-level privileges (
CONNECT,RESOURCE,DBA), omit theONclause entirely. - For table-level privileges, always include the
ONclause naming the specific table. - Never mix database-level and table-level privileges in the same
GRANT/REVOKEstatement — issue them as separate statements.
Examples
Database-level privilege with an incorrect ON clause
GRANT DBA ON orders TO app_user;
-- -279: DBA is a database-level privilege — no ON clause allowed
Fix:
GRANT DBA TO app_user;
Table-level privilege missing its ON clause
GRANT SELECT TO app_user;
-- -279: SELECT is a table-level privilege — requires an ON clause
Fix:
GRANT SELECT ON orders TO app_user;
Mixing the two kinds in one statement
GRANT DBA, SELECT ON orders TO app_user;
-- -279: mixing a database-level privilege (DBA) with a
-- table-level one (SELECT) in the same statement
Fix — issue as two separate statements:
GRANT DBA TO app_user;
GRANT SELECT ON orders TO app_user;
Diagnostic Checks
- Review the
GRANT/REVOKEstatement for which privilege type(s) are named and whether anONclause is present or absent appropriately for each. - Check for mixed privilege types in a single statement.
Related Errors / Related Topics
- -272 — "No SELECT permission for table/column." Part of the same general privileges
family, though about a missing grant rather than incorrect
GRANTsyntax. - -201 — "A syntax error has occurred." The general SQL-parsing-error family this fits into.
Remember the rule: database-level privileges never take an ON clause; table-level privileges
always do — and never combine the two kinds in one statement.