| From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
|---|---|
| To: | Carlos Alberto Márquez Rey <carlos_marquez_rey(at)yahoo(dot)com> |
| Cc: | pgsql-es-ayuda(at)postgresql(dot)org |
| Subject: | Re: Trigger no funciona, una ayuda por favor |
| Date: | 2007-01-12 00:39:52 |
| Message-ID: | 20070112003952.GK10464@alvh.no-ip.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-es-ayuda |
Carlos Alberto Márquez Rey escribió:
> Tengo el siguiente trigger y funcion trigger
>
>
> CREATE OR REPLACE FUNCTION tru_rel_nombres_elementos()
> RETURNS "trigger" AS
> $BODY$
> begin
> if TG_OP = 'INSERT' or TG_OP = 'UPDATE' then
> NEW.fec_ult_act = now();
> end if;
> if TG_OP = 'DELETE' then
> end if;
> return null;
> end;
> $BODY$
> LANGUAGE 'plpgsql' VOLATILE;
> ALTER FUNCTION tru_rel_nombres_elementos() OWNER TO postgres;
cambia el return null por "RETURN NEW"
>
> CREATE TRIGGER tru_rel_nombres_elementos
> AFTER INSERT OR UPDATE OR DELETE
> ON rel_nombres_elementos
> FOR EACH ROW
> EXECUTE PROCEDURE tru_rel_nombres_elementos();
Cambia "AFTER INSERT" por "BEFORE INSERT".
Con eso deberia funcionar
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2007-01-12 01:16:18 | Re: Permisos! |
| Previous Message | José Fermín francisco ferreras | 2007-01-12 00:37:34 | RE: Cual es el tipo float correspondiente en postgresql? |