Error when assigning a role to user
You can only GRANT to a PostgreSQL role.  If you have created your own role system at the application level, storing the data about them in the database, PostgreSQL has no idea that you did that and certainly isn't going to grant PostgreSQL privileges to these roles.

You either need to convert the users listed in "myeg_users" into PostgreSQL users/roles, or you need your app server to connect as PostgreSQL user "role1" and then to voluntarily do only those things the app-side role it is implementing is allowed to do.