select aa.attribute_id, coalesce(aa.column_name, aa.attribute_name) as column_name, aa.default_value, coalesce(aa.table_name,at.table_name) as table_name, aa.storage, aa.datatype, aa.sort_order, aa.attribute_name, aa.pretty_name, aa.pretty_plural
from acs_attributes aa,
ca_attributes ca, acs_object_types at
where aa.attribute_id = $attribute_id
and aa.attribute_id = ca.attribute_id
and (ca.package_id = :package_id or ca.sitewide_p = 't')
and aa.object_type = :content_type
and at.object_type = :content_type
order by sort_order
select ca_attributes__drop_attribute(:content_type, :attribute_name);