-- Fail upon insertion of a key into ISOK_QUERIES that's a duplicate -- when compared in a case-insensitive fashion. INSERT INTO isok_queries ( iqname, error, type, keep -- , first_run, last_run , role, search_path, query, comment) VALUES('Query1' , false , 'type1' , false , NULL , NULL , $$VALUES ('R1', 'Result number 1', NULL) , ('R2', 'Result number 2', NULL) , ('R3', 'Result number 3', NULL);$$ , 'No comment' ); ERROR: duplicate key value violates unique constraint "ISOK_QUERIES.IQName is case-insensitively unique" DETAIL: Key (lower(iqname))=(query1) already exists.