Re: [Pgsql-ayuda] return new, return old, trigger

From: Alvaro Herrera Munoz <alvherre(at)dcc(dot)uchile(dot)cl>
To: sandrigo lezcano <alkafes(at)yahoo(dot)com>
Cc: pgsql-ayuda(at)tlali(dot)iztacala(dot)unam(dot)mx
Subject: Re: [Pgsql-ayuda] return new, return old, trigger
Date: 2003-08-12 20:16:09
Message-ID: 20030812201609.GD16697@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On Tue, Aug 12, 2003 at 10:39:56AM -0500, sandrigo lezcano wrote:
> algun consejo sencillo para ayudarme a establecer
> si mi retorno en una
>
> function-trigger sea new o old ???

???

> entiendo (creo... segun manual)
> NEW: variable holding (..???) para operacion INSERT/UPDATE
> en la nueva tupla ... ????
> OLD: variable holding (..???) para operacion UPDATE/DELETE
> en la ultima tupla (vieja) ..??

Traduccion:

NEW es la variable que tiene la tupla despues del UPDATE.
OLD es la variable que tiene la tupla antes del UPDATE.

(OLD solo existe en UPDATE y DELETE;
NEW solo existe en INSERT y UPDATE)

> CREATE FUNCTION tub_personas () RETURNS TRIGGER AS '
[...]
> if update(cedula) then

"if update(cedula)" creo que se dice "if NEW.cedula <> OLD.cedula".

--
Alvaro Herrera (<alvherre[(at)]dcc(dot)uchile(dot)cl>)
www.google.com: interfaz de linea de comando para la web.

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message sandrigo lezcano 2003-08-12 20:39:37 Re: [Pgsql-ayuda] return new, return old, trigger
Previous Message Edwin Quijada 2003-08-12 18:30:04 Re: [Pgsql-ayuda] Select diferente