Funcion no ejecuta correctamente en postgres 10

From: jvenegasperu <jvenegasperu(at)gmail(dot)com>
To: Ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Funcion no ejecuta correctamente en postgres 10
Date: 2018-04-15 21:59:12
Message-ID: CA+KjtGd3x=Qhu0iDc5nF8PHmhqG5qv4GsfSidUU+qM43TvSWiA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Buen dia a todos

tengo esta funcion y trigger y no me esta actualizando el valor
correctamente en 9.6 funciona bien en 10 no alguna ayuda?
el campo numero de la tabla se queda null.

es como si funcionara todo excepto esta linea

new.numero := id;

CREATE OR REPLACE FUNCTION func_numeracion()
RETURNS trigger AS
$BODY$
DECLARE
id INTEGER;
BEGIN
--SELECT numero FROM fe_numeraciones where doc = NEW.doc and serie =
NEW.serie LIMIT 1 INTO id FOR UPDATE;
SELECT numero FROM fe_numeraciones where doc = NEW.doc and serie =
NEW.serie LIMIT 1 INTO id;
update fe_numeraciones set numero = id + 1 where doc = New.doc and
serie = NEW.serie;
NEW.numero := id;
RETURN NEW;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION func_numeracion()
OWNER TO postgres;

END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION func_numeracion()
OWNER TO postgres;

-- DROP TRIGGER fn ON fe_retencion;
CREATE TRIGGER numeracion
AFTER INSERT
ON con_diario
FOR EACH ROW
EXECUTE PROCEDURE func_numeracion();

--
José Mercedes Venegas Acevedo
cel Mov RPC 964185205

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Edgardo Hernández 2018-04-15 23:22:10 Re: Funcion no ejecuta correctamente en postgres 10
Previous Message jvenegasperu 2018-04-15 17:14:28 modificar tipo de dato postgres