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

408
Visualizações
postgresql return error : ERROR: canceling statement due to user request

I'm using postgresql 9.6,it's ok to execute in psql command:

  select pg_cancel_backend(a.pid)  from pg_locks a join pg_class b on a.relation = b.oid join pg_stat_activity c on a.pid = c.pid where c.datname = 'mydb' and a.mode like '%AccessShareLock%'; 

However, it prompts an error : "ERROR: canceling statement due to user request" when I execute the following scripts:

/app/postgres/pgsql/bin/psql -h "127.0.0.1" -p 6661 -U "postgres" -d "mydb" -tc "select pg_cancel_backend(a.pid)  from pg_locks a
> join pg_class b on a.relation = b.oid
> join pg_stat_activity c on a.pid = c.pid
> where c.datname = 'mydb' and a.mode like '%AccessShareLock%';"

what is the difference between this two methods?

enter image description here

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

0

Both methods execute the same statement, so the end result is the same. However, when you use the psql command, you can run it directly from the shell. The first command requires that you are already connected to postgres.

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