Subject RE: [firebird-support] Role issues
Author Alan McDonald
> Hi, I've created this simple stored procedure to check that
> the role is what I think it is:
>
> CREATE PROCEDURE SP_CURRENT_ROLE returns (
> RESULT VarChar(31))
> AS
> BEGIN
> /* Procedure body */
> RESULT = CURRENT_ROLE;
> SUSPEND;
> END
>
> Sadly, this always returns "NONE" which contradicts Helen's
> Bible of Firebird which says if the role is undefined, it
> should be an empty string. In this case though I've created 2
> roles and am running this script logged in with one of them.
> But no matter what role I use, even if I use a role that I
> know is undefined ("bogusRole") my stored procedure always
> returns NONE.
>
> If I change my proc as:
> RESULT = CURRENT_USER;
>
> I get SYSDBA as expected.
>
> Can anyone shed some light on how one logs in using a role
> correctly? I have tried this from multiple client tools,
> Delphi, EMS, DataWorkbench - all have the same issue so I
> assume it is not a client problem, but something I'm doing
> wrong in defining my roles perhaps?
>
> regards,
> -randall sell

If you have not granted this role to the user you are using, then
current_role will not return a value other than NONE, even though you log on
with that role.
Make sure you have granted the role to the user - then you get the role back
Alan