I created a user/role in postgres db and set default search_path to a specific schema. Now what I am trying to achieve is connect to the database using the new user/role and be able to work on that schema for all queries to database.
CREATE ROLE ltv_dev WITH PASSWORD '<some password>';
So I was hoping if I can connect to the database using a connection string that is for the user/role from a .net core web client using Npgsql.
My previous connection string was.
"NpgsqlConnectionStringOptions": {
"Server": "server_location",
"Port": 5432,
"Database": "db_name",
"UserId": "original_user_id",
"Password": "pwd"
}
I tried changing the UserId from the previous connection string to the new user/role and the password as well.
My new connection string
"NpgsqlConnectionStringOptions": {
"Server": "server_location",
"Port": 5432,
"Database": "db_name",
"UserId": "ltv_dev",
"Password": "password_for_the_role"
}
But it did not work.
Is there any way I can connect to the database using a custom user/role from a .net client using Npgsql or is there another approach to solving this issue? Thanks
You have created a role without LOGIN privilige, the NOLOGIN option is by default in CREATE ROLE, or you can use CREATE USER:
CREATE USER ltv_dev PASSWORD '<some password>';
you can see it in the documentation