Upgrade Ubuntu to a newer version, but keep current postgres version

i feel like i would have to upgrade my Ubuntu installation to a newer release, but i have a application, which relies on Postgres 8.4. I would like to upgrade say from ubuntu 10.04 to 12.04 or 14.04 but keep the postgres 8.4. The migration of this application to Postgres 9.1 or higher would cost quite a lot of time and if i can save the effort, i’d rather to. The application has much customization and those would have been customized for a higher Postgres version, if 8.4 would be no longer usable, this would render the application useless.

Any idea, how to upgrade, but keep the postgres 8.4 running. Are there any settings in Webmin/Virtualmin, which i could utilize?

Thanks and best