-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- TRIGGER BEFORE INSERT
-- Tabla: sga_llamados_mesa
-- Version 3.0.0
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

-- DROP FUNCTION ftib_sga_llamados_mesa();
CREATE OR REPLACE FUNCTION ftib_sga_llamados_mesa() RETURNS TRIGGER AS $BODY$
  BEGIN
	   -- Genera un registro en la tabla de entidades..
       NEW.entidad := f_generar_entidad(401);
       RETURN NEW;
  END;
$BODY$ LANGUAGE plpgsql;


-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Trigger de INSERT sobre sga_llamados_mesa
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- DROP TRIGGER tib_sga_llamados_mesa  ON sga_llamados_mesa RESTRICT;;
CREATE TRIGGER tib_sga_llamados_mesa BEFORE INSERT ON sga_llamados_mesa
    FOR EACH ROW EXECUTE PROCEDURE ftib_sga_llamados_mesa();
