postgresql7.1 select apm_package_version__version_name_greater(:version_name, highest.version_name) from (select version_name from apm_package_versions where version_id IN (select apm_package__highest_version(:package_key)) ) highest