That seems like a really arbitrary number of milliseconds to use as a maximum. What can I do if I want to log even longer-running queries on a data warehouse?
This is not specific to AWS RDS (well part of it specific to that), it is in the upstream code.
The setting is restricted to
INT_MAX / 1000. But I can't figure out why, as that setting is never multiplied by anything, much less 1000. This seems like a bug to me. You might want to report it to the PostgreSQL bugs mailing list.
In the meantime, I guess your option would be to set it to the max and then filter your log files. It seems unlikely to have millions of queries each taking 40 minutes, so filtering it shouldn't be too onerous.
And soon after your report, it has been fixed in
PostgreSQL for all supported versions. It will be included in the next bugfix release, which is due out soon. I don't know when Amazon is likely to both roll out the next bugfix release to RDS, and fix their own independent bug on the same subject matter.