From: Tomasz Myrta <jasiek@klaster.net>
To: Maurício Sessue Otta <mauricio@cristorei.com.br>
Cc: LISTA POSTGRES <pgsql-sql@postgresql.org>
Subject: Re: Trigger para fazer log
Date: Thu, 06 Feb 2003 14:49:40 +0100
Message-ID: <3E4267F4.6020302@klaster.net> (raw)
References: <002301c2cdd8$30b82640$830101c0@mauricio1>
Maurício Sessue Otta wrote:
> Oi lista,
>
> tenho um trigger que deve validar alguns campos para entrada/saida de
> funcionarios e que deve fazer um "log"
> do que vai acontecendo.
>
> Por exemplo:
> quando é o início do expediente, o trigger deverá guardar algo assim no
> "log":
> Cadastro da Entrada-1: Data 2003-02-06 Horário: 09:51:00
>
> Se o funcionario tentar burlar o esquema e tentar inserir/atualizar o
> registro, o trigger deve guardar na tabela log que
> foi feita essa tentativa e retornar um erro para o meu script PHP.
>
> Meu problema:
> no fim do trigger tenho o seguinte:
> IF length(m_erro) = 0 THEN
> ELSE
> RAISE EXCEPTION ''%'', m_erro;
> END IF;
> RETURN null;
> Quando está "EXCEPTION", o que deveria ser guardado no "log" também é
> desfeito. Quando coloco "NOTICE", a
> informação vai para o LOG.
>
> Como fazer para o trigger gerar uma "EXCEPTION" e mesmo assim gravar em
> outra tabela?!?!
>
>
> []'s Mauricio
I can't understand your language ;-) but I suppose, that after "RAISE EXCEPTION"
you can't find any information in a log table?
RAISE EXCEPTION always aborts transaction and you can't put any log information
into tables when doing this.
Regards,
Tomasz Myrta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasiek@klaster.net, mauricio@cristorei.com.br
Subject: Re: Trigger para fazer log
In-Reply-To: <3E4267F4.6020302@klaster.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox