--
-- wp_presentation__get_audience/1
--
create or replace function wp_presentation__get_audience(
  integer
) returns text as $$

declare
    p_pres_item_id  alias for $1;
begin
    return content
    from cr_revisions, cr_items
    where cr_items.content_type = 'cr_wp_presentation_aud'
    and cr_items.parent_id = p_pres_item_id
    and cr_revisions.revision_id = cr_items__live_revision;
end;$$ language plpgsql;