If index
CREATE UNIQUE INDEX toode_toode_unique_pattern_idx ON firma1.toode USING btree (lower(toode::text) text_pattern_ops);
is dropped, this error does not occur.