Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

251
Visualizações
Can I connect as a custom user/role to postgresql db?

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

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

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

CREATE ROLE

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda