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

216
Visualizações
PSQL not prompting for password in PowerShell

This PSQL statement in PowerShell:

.\psql --% -h localhost -p 5000 -U postgres -d mydatabase -c `
(SELECT * ...... do something);

Works - and does not prompt for a password.

.\psql.exe --help

States the -w switch is required for no password.

Why does this command work without a password? The database has a password.

The command does not work in the PSQL interactive shell without password authentication, only in PowerShell.

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

0

-w is not required for "no password" reread what it says, from my man psql

-w --no-password Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \connect as well as the initial connection attempt.

-w is meant for when you're running psql scripts and input for a password is not possible, like in a headless session.

Why does this command work without a password? The database has a password.

Even if the database has a password, if your pg_hba.conf file has trust no password will be required. To debug this further we need to see your pg_hba.conf.

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