postgresql7.2 insert into workflow_actions (action_id, workflow_id, sort_order, short_name, pretty_name, pretty_past_tense, edit_fields, assigned_role, always_enabled_p, description, description_mime_type, timeout) values (:action_id, :workflow_id, :sort_order, :short_name, :pretty_name, :pretty_past_tense, :edit_fields, :assigned_role_id, :always_enabled_p, :description, :description_mime_type, [ad_decode $timeout_seconds "" "null" "interval '$timeout_seconds seconds'"]) timeout = [ad_decode $attr_timeout_seconds "" "null" "interval '$attr_timeout_seconds seconds'"] select a.action_id, a.workflow_id, a.sort_order, a.short_name, a.pretty_name, a.pretty_past_tense, a.edit_fields, a.assigned_role as assigned_role_id, (select short_name from workflow_roles where role_id = a.assigned_role) as assigned_role, a.always_enabled_p, (select case when count(*) = 1 then 't' else 'f' end from workflow_initial_action where workflow_id = a.workflow_id and action_id = a.action_id ) as initial_action_p, fa.new_state as new_state_id, (select short_name from workflow_fsm_states where state_id = fa.new_state) as new_state, a.description, a.description_mime_type from workflow_actions a left outer join workflow_fsm_actions fa on (a.action_id = fa.action_id) where a.workflow_id = :workflow_id and fa.action_id = a.action_id order by a.sort_order select coalesce(max(sort_order),0) + 1 from workflow_action_callbacks where action_id = :action_id insert into workflow_action_allowed_roles select :action_id, (select role_id from workflow_roles where workflow_id = :workflow_id and short_name = :allowed_role) as role_id