postgresql7.1 select wp_attachment__new( :attachment, :display, :slide_item_id, now(), :user_id, :creation_ip ); insert into cr_mime_types (mime_type) select :mime_type where not exists (select 1 from cr_mime_types where mime_type = :mime_type) select content_item__set_live_revision(:revision_id); insert into cr_wp_attachments ( attach_id, display ) select :revision_id, :display where not exists (select 1 from cr_wp_attachments where attach_id = :revision_id)