postgresql7.2 select w.workflow_id, w.short_name, w.pretty_name, w.object_id, w.package_key, w.object_type, a.short_name as initial_action, a.action_id as initial_action_id from workflows w left outer join workflow_initial_action wia on (w.workflow_id = wia.workflow_id) left outer join workflow_actions a on (a.action_id = wia.action_id) where w.workflow_id = :workflow_id select workflow__new ( :short_name, :pretty_name, :package_key, :object_id, :object_type, :creation_user, :creation_ip, :context_id ); select workflow__delete(:workflow_id); select coalesce(max(sort_order),0) + 1 from workflow_callbacks where workflow_id = :workflow_id