title: Why a PostgreSQL query ran 3 days as a scheduled Windows task?
body: <p>I have a Windows scheduled task which has to run a batch file. The batch file is PostgreSQL query to insert some data. What we saw from the logs is that the task was triggered &amp; got a process id too. But the task has no other update in the logs &amp; kept on running for 3 days. We are not able to find the reason for it to run for 3 days. Also when the task was run, no user had logged in. In a similar case we got return code 1 when we replicated. Anybody has faced similar issues?</p>
  
  <p>UPDATE:</p>
  
  <pre><code>psql -h localhost -d dbname -p 5432 -U postgres -w -f pathToSqlQueryFile
  </code></pre>
  
  <p>The sql query file contains a sql query with case statements to calculate working hours. The password is provided in the pgpass file.</p>