postgresql7.1
select package_key, pretty_name, version_name, installed_p
from apm_package_version_info
where version_id = :version_id
select dependency_id, service_uri, service_version
from apm_package_dependencies
where version_id = :version_id
and dependency_type = :dependency_type_prep
order by service_uri
select t.pretty_name as dep_pretty_name, v.version_name as dep_version_name,
v.version_id as dep_version_id
from apm_package_versions v, apm_package_dependencies d, apm_package_types t
where d.service_uri = :service_uri
and d.dependency_type = :other_dependency_type_prep
and d.version_id = v.version_id
and t.package_key = v.package_key
and apm_package_version__sortable_version_name(d.service_version) $sign
apm_package_version__sortable_version_name(:service_version)