I'm trying to run pg_archivecleanup from our DR Postgres server (Windows), but I am getting return code 2. I am guessing that the issue may be permissions since I can run the command myself and it works fine, but the Postgres service logs return code 2 and does nothing. I'm hoping that there might be more information about the return code than the Postgres log provides ('archive location does not exist')

I have looked in the online and offline documentation and googled to try and get more information about what the return codes mean, but cannot find the information. I don't really want to have to read the code myself for it, as I am not a C developer and may miss some nuance of it's behaviour (even if it is well written enough that I can understand it).

Can anyone help point me towards a reference somewhere (that is apparently hidden from search engines!), or maybe even list the return codes and their meanings here?

1 Answer 1


I'm not a C programmer either, but it doesn't take much to see in the code


that return code 2 is used for many different failures. Search for exit(2). It looks like all of them print error messages to stderr.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.