Postgresql Variable Interest Calculator