Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Crear una RULE con SELECT e INSERT ?¿

From: Horacio Miranda <hmiranda(at)gmail(dot)com>
To: Gunnar Wolf <gwolf(at)gwolf(dot)org>
Cc: juanramirez <juanramirez(at)cajazacate(dot)com(dot)sv>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>, pgsql-es-ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Crear una RULE con SELECT e INSERT ?¿
Date: 2011-01-23 22:20:44
Message-ID: AANLkTim4nxfRNpyOVy2kKH5kLS-GeeWe0UMyBbTSg5_h@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Tal ves, habilitar de forma agresiva el log como sugirio alvaro, y
hacer un parser con perl (según una lista de tablas a auditar) para no
guardar el 100% de las consultas ?

Apuntar el log a algo como /dev/shm (para rendimiento) y guardar las
consultas con un pipe a gzip (para tener los logs, comprimidos) ?

2011/1/21 Gunnar Wolf <gwolf(at)gwolf(dot)org>:
> Gunnar Wolf dijo [Thu, Jan 20, 2011 at 06:23:26PM -0600]:
>> Desconozco las sutilezas de las reglas, pero... ¿Qué pasa si..
>>
>> • Abro una transacción
>> • Hago un select
>> • Hago rollback
>>
>> ..?
>>
>> ¿Se registra o no?
>
> Ok, acá me encontré la respuesta:
> +------------------------------------------------------------
> | http://www.mail-archive.com/pgsql-general(at)postgresql(dot)org/msg74280.html
> +------------------------------------------------------------
> | > But is nowhere stated if (multiple) commands inside a rule are
> | > treated
> | > as an implicit transaction as a whole.
> |
> | If you don't specifically open a transaction at the top level (i.e. in
> | 'psql' or SQL from your application's code), PG will encapsulate every
> | query you execute within its own transaction.  The statements in any
> | rules called will execute in the context of that transaction, along
> | with any other operations such as trigger calls, table updates,
> | whatever.  If something in that implicit transaction fails, it will be
> | rolled back; otherwise, it will be committed once the statement is
> | finished.
> |
> | Also, you need to think of rules as 'query rewrites' rather than
> | 'code that executes', because that's what they are.
> |
> | I hope that helps.
> |
> | -Doug
> +------------------------------------------------------------
>
> En pocas palabras: Una regla reescribe las solicitudes, por lo cual
> todo lo que dispares desde una regla queda inscripto en la misma
> transacción en la que estabas.
> -
> Enviado a la lista de correo pgsql-es-ayuda (pgsql-es-ayuda(at)postgresql(dot)org)
> Para cambiar tu suscripción:
> http://www.postgresql.org/mailpref/pgsql-es-ayuda
>

--
Saludos,
Horacio Miranda Aguilera.

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Christian Guarrera 2011-01-24 15:26:02 elementos duplicados
Previous Message Jorge Tornero 2011-01-21 12:42:00 Expresiones arbitrarias en GROUP BY