Thank to Terry I've tried to write rule instead of trigger but have
another problem.
CREATE RULE g_oferty_id_oferty_rule AS ON INSERT TO g_oferty WHERE
(new.id_oferta IS NULL) DO INSTEAD INSERT INTO g_oferty (id_oferta, ...)
VALUES (DEFAULT, new.d..);
But got ' infinite recursion detected in rules for relation "g_oferty" '
error. The second insert should not fire this Rule...
Martin