postgresql7.1 select case when acs_permission__permission_p(:ticket_id, :user_id, 'write') = 't' then 1 else 0 end as write_p, case when acs_permission__permission_p(:ticket_id, :user_id, 'admin') = 't' then 1 else 0 end as admin_p select tt.subject, cr.content as description, cr.mime_type, ttracker_option__option_name(:package_id, 'severity', tt.severity) as pretty_severity, ttracker_option__option_name(:package_id, 'priority', tt.priority) as pretty_priority, to_char(tt.creation_date, 'MM/DD/YYYY HH24:MI') as created, tc.name as category, tc.category_id, acs_object__name(tt.creation_user) as submitted_by, wc.state, wc.case_id from ttracker_tickets tt, ttracker_categories tc, wf_cases wc, cr_revisions cr where tt.ticket_id = :ticket_id and tc.category_id = tt.category_id and wc.object_id = :ticket_id and cr.revision_id = content_item__get_live_revision(tt.ticket_id) select acs_object__name(wta.party_id) as name from wf_task_assignments wta where wta.task_id = (select max(wt.task_id) from wf_tasks wt, wf_cases wc where wc.object_id = :ticket_id and wt.case_id = wc.case_id and wt.transition_key = 'resolve')