Re: Replicacion?

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: cbeltran <cbeltran(at)roldan(dot)net>
Cc: Pablo Marrero <pablo(dot)marrero(at)bancaqm(dot)com(dot)uy>, AyudaPostgres <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Replicacion?
Date: 2004-09-09 00:04:39
Message-ID: 20040909000439.GA9861@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On Wed, Sep 08, 2004 at 04:48:40PM -0500, cbeltran wrote:

> Es decir la operacion (INSERT / UPDATE / DELETE) se toma directamente de
> TG_OP y por lo tanto cambio el tipo a character(6) y ademas en la funcion
> hubo que agregar un IF pues se debe especificar la linea OLD para DELETE y
> la linea NEW para INSERT y UPDATE.

Por que no usas un CASE? Algo como

INSERT INTO control_replica
(tablas_replica_id, linea_tabla_replica_id, operacion)
VALUES
(180000001, CASE WHEN TG_OP = ''DELETE'' THEN OLD.terceros_id ELSE NEW.terceros_id END, TG_OP);

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The first of April is the day we remember what we are
the other 364 days of the year" (Mark Twain)

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2004-09-09 00:30:40 Re: ayuda con optimizacion de consulta
Previous Message Patricio Muñoz 2004-09-08 22:06:11 Re: Stored Procedures en PostGres