CREATE FUNCTION normkont () RETURNS TRIGGER AS $$
BEGIN
  IF NEW.kontynent IS NOT NULL THEN
    NEW.kontynent := lower(NEW.kontynent);
    NEW.kontynent := initcap(NEW.kontynent);
  END IF;
  RETURN NEW;
END;
$$ LANGUAGE 'plpgsql';

CREATE TRIGGER gatwyzw1
  BEFORE INSERT OR UPDATE ON Gatunki
  FOR EACH ROW
  EXECUTE PROCEDURE normkont();
