I am trying to create a task job with pg_agent. I have created a new job, schedule, and step. They are all enabled. In my step, I have such a query to get run:
DELETE FROM "ID: 889197824 CH: 0006 Messdaten" t
USING (
SELECT "Zeit" FROM "ID: 889197824 CH: 0006 Messdaten" WHERE "Zeit" < ts2oadate(now() - (interval '3 Months'))
) d
LEFT JOIN (
SELECT min("Zeit") AS "Zeit"
FROM "ID: 889197824 CH: 0006 Messdaten"
WHERE "Zeit" < ts2oadate(now() - (interval '3 Months'))
GROUP BY date_trunc('hours',oadate2ts("Zeit"))
) x USING ("Zeit")
WHERE x."Zeit" IS NULL
AND d."Zeit" = t."Zeit";
After checking event viewer of the pg_agent service, I found out such an error:
Failed to create new connection for connection string 'user=postgres host=localhost port=5432 dbname=test_db':fe_sendauth: no password supplied
This is the pgpass.conf
localhost:5432:postgres:postgres:xxxx
Do you have any idea what would be the problem?
Some more info:
This is job
This is schedule
And this is step
I actually solved the problem by changing the pgpass.conf in the path:
postgres\AppData\Roaming\postgresql
to
localhost:5432:*:postgres:xxx
Before I was trying to change the wrong pgpass.conf which is in the path:
pcUser\AppData\Roaming\postgresql
I hope, it helps someone else