Subject Cannot grant user by code
Author Pierre Y.
Hi,

I want to add readonly user creation/granting after database initialisation.

I create the database using a bunch of SQL scripts. After the last script runs, I create a user using "create user MYUSER password 'myPassword'" the I grant this user read only (select, references) access to every table of the database using EXECUTE BLOCK :

https://gist.github.com/zedalaye/6300b679e56349c40b973d35bb4c91ee

On Transaction Commit, I get this error :

add record error violation of PRIMARY or UNIQUE KEY constraint "INTEG_2" on table "PLG$USERS" Problematic key value is ("PLG$USER_NAME" = 'RO_USER') Unsuccessful execution caused by system error that does not preclude successful execution of subsequent statements GDS Code: 336723987 - SQL Code: -901 - Error Code: 19.

I use latest Firebird 3.0.2.32703, Delphi XE2 and UIB from Git Repository. The database is created in a Linux instance hosted by a VM on the same machine using inet4 connexion with SYSDBA user.

Many thanks,

-- Pierre Yager