Two users, different databases, same user_id

Hello,

I found that you can have two users, each in a different database, with the same user_id. This presents a problem when calling management APIs that take a single parameter: the user_id.

I created two users as mentioned above: same user_id, different dbs. Then I did the following using the management API -
Get user: returned the first user I created.
Update user: updated the second user I created.
Delete user: deleted the second user I created.

Is there a way around this? If those APIs took a db connection id parameter it would work.

Hi @tswetonic,

Yes, having users with the same user_id across different databases can cause ambiguity when making Management API calls to get, update, or delete a user.

One way to work around this is to append a prefix to the user_id when creating your users, indicating the specific database the user belongs to. This ensures that each user has a unique user_id.

I hope this helps!

Thanks,
Rueben

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.