Re: Trigger

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Leonardo Porras Sànchez <lporras(at)siid-ltda(dot)com>
Cc: postgres <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Trigger
Date: 2006-03-14 23:43:13
Message-ID: 20060314234313.GD8263@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Leonardo Porras Sànchez escribió:

Hola,

> BEGIN
> sample = OLD.ssp_id_sample;
> ssource = OLD.ssp_source;
> IF ssource='GPS' THEN
> SELECT * INTO gpt FROM surface_gps_point WHERE gpt_id_sample=sample;
> IF FOUND THEN
> sdate = gpt.gpt_date_hour;
> UPDATE surface_locsamples SET ssp_date=sdate WHERE
> ssp_id_sample=sample;

Creo que en vez de hacer este UPDATE podrias cambiar NEW.ssp_date.

> IF FOUND THEN
> sdate = psr.psr_date_begun;
> UPDATE surface_locsamples SET ssp_date=sdate WHERE
> ssp_id_sample=sample;

Ditto

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

  • Trigger at 2006-03-14 18:58:55 from Leonardo Porras Sànchez

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2006-03-15 00:15:34 Re: Limitar el número de registros actualizados o borrados
Previous Message Miguel 2006-03-14 21:59:07 Re: Comparar