No link
https://www.postgresql.org/docs/current/sql-createview.html
veja a seção Parameters (Parâmetros) logo no início
"WITH [ CASCADED | LOCAL ] CHECK OPTION
This option controls the behavior of automatically updatable views. When this option is specified, INSERT and UPDATE commands on the view will be checked to ensure that new rows satisfy the view-defining condition (that is, the new rows are checked to ensure that they are visible through the view). If they are not, the update will be rejected. If the CHECK OPTION is not specified, INSERT and UPDATE commands on the view are allowed to create rows that are not visible through the view. The following check options are supported:
LOCAL
New rows are only checked against the conditions defined directly in the view itself. Any conditions defined on underlying base views are not checked (unless they also specify the CHECK OPTION).
CASCADED
New rows are checked against the conditions of the view and all underlying base views. If the CHECK OPTION is specified, and neither LOCAL nor CASCADED is specified, then CASCADED is assumed.
The CHECK OPTION may not be used with RECURSIVE views.
Note that the CHECK OPTION is only supported on views that are automatically updatable, and do not have INSTEAD OF triggers or INSTEAD rules. If an automatically updatable view is defined on top of a base view that has INSTEAD OF triggers, then the LOCAL CHECK OPTION may be used to check the conditions on the automatically updatable view, but the conditions on the base view with INSTEAD OF triggers will not be checked (a cascaded check option will not cascade down to a trigger-updatable view, and any check options defined directly on a trigger-updatable view will be ignored). If the view or any of its base relations has an INSTEAD rule that causes the INSERT or UPDATE command to be rewritten, then all check options will be ignored in the rewritten query, including any checks from automatically updatable views defined on top of the relation with the INSTEAD rule."
e depois mais abaixo veja a seção Updatable Views.
E veja que aqui tu tem uma função e não uma view:
create or replace function cadastro
E aqui tu encontra exemplos de UPSERT com a cláusula ON CONFLICT, a partir da versão 9.5 do Postgres:
https://www.postgresql.org/docs/9.4/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPINGhttps://ww...
https://www.postgresql.org/docs/devel/sql-insert.html
Qualquer coisa usa a opção de tradução automática do Google Chrome ou o Google Tradutor.
Mas segue uma sugestão para o último bloco:
...
IF(exists(select id_filial from ramal_filial where id_filial=p_id_filial)) THEN
INSERT INTO empresa(id_filial,endereco,infos) values(p_id_filial,p_ender,p_infos);
ELSE
UPDATE empresa
SET nr_ramal = nr_ramal <<< aqui verifique se é isso mesmo
WHERE id_filial = p_id_filial
END IF;
RETURN 'Informações cadastradas com sucesso';
end;
$BODY$
________________________________________________
Always listen the Buck!