create function duplicate_images() returns OPAQUE as' DECLARE myrec RECORD; BEGIN if TG_OP =
''INSERT''then select * into myrec from images where page=NEW.page and
path=NEW.path; if found then raise exception ''insert failed: duplicate record found'';
end if; end if; end;
' language 'plpgsql';