Informix Error -19806: Cannot grant database privileges or default role to a role.
Cause and resolution
Cannot grant database privileges or default role to a role.
A role cannot be granted database-level privileges. Use the GRANT statement to grant database-level privileges to the user or to PUBLIC.
A default role cannot be granted to a role. Use the GRANT DEFAULT ROLE statement to grant default role to the user or to PUBLIC.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-19806 fires when database-level privileges or a default role are granted to a role rather
than a user or PUBLIC — per the official guidance.
- Database-level privileges granted to a role, per the official guidance — only users
or
PUBLICcan receive these. - A default role granted to a role, per the official guidance — only users or
PUBLICcan receive one.
Solutions / Resolution
- Use
GRANTto give database-level privileges to the user orPUBLICinstead of a role, per the official guidance. - Use
GRANT DEFAULT ROLEto give a default role to the user orPUBLICinstead of a role, per the official guidance.
Examples
Granting database privileges to a role
GRANT CONNECT TO myrole;
-- -19806: database-level privileges can't go to a role
Corrected
GRANT CONNECT TO myuser;
Diagnostic Checks
- Check whether the
GRANTtarget is a role, and redirect database-level privileges or default-role grants to a user orPUBLIC.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -19806 in this set yet.
Database-level privileges or a default role can't be granted to a role — grant them to a
user or PUBLIC instead.