Informix Error -299
-299 Cannot grant permission to self.
This GRANT statement includes your user id as one of the grantees. If you can grant the privilege, you already have the privilege. Rewrite the statement to omit your user name from the TO clause.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-299 is a straightforward sanity check: the user executing a GRANT statement already has the
privilege being granted — you can't grant something to yourself, since granting itself requires
already possessing it.
- The executing user's own ID appears in the
GRANT ... TOlist — the direct, only cause. - A
GRANTstatement built from a list of usernames programmatically, where the current user's own name wasn't filtered out first. - Copy-pasted
GRANTstatements from another context where the grantee list happened to include whoever is now running the statement.
Solutions / Resolution
- Remove the executing user's own ID from the
TOclause, per the official guidance — the privilege is implicitly already held. - When generating grant statements from a list of users programmatically, filter out the current session's own user ID first, to avoid hitting this on some runs and not others depending on who executes the script.
Examples
The disallowed self-grant
-- Executed as user 'dba_admin':
GRANT SELECT ON customers TO dba_admin, report_user;
-- -299: dba_admin is granting to itself
Fix — remove the executing user from the list:
GRANT SELECT ON customers TO report_user;
Filtering a programmatically-built grantee list
-- Before running, exclude CURRENT_ROLE / the current session's own user
-- from any generated TO clause, rather than hardcoding a fixed list that
-- happens to include whoever runs the script this time.
Diagnostic Checks
- Check whether the executing user's own login appears in the
GRANT ... TOlist — this is the only condition that triggers -299.
Related Errors / Related Topics
- -298 — "Cannot grant permission to public with grant option." Another
GRANT-clause restriction in the same privilege-management family. - -201 — "A syntax error has occurred." The general SQL-parsing-error family this fits into.
The fix is always the same: drop the executing user's own ID from the grantee list — they already hold whatever privilege they're trying to grant.