Re: [GENERAL] Trigger documentation? Need more examples.. pleeeze.. ;-) - Mailing list pgsql-general

From Henrique Pantarotto
Subject Re: [GENERAL] Trigger documentation? Need more examples.. pleeeze.. ;-)
Date
Msg-id 9908200953040H.00439@scanner.cepa.com.br
Whole thread Raw
In response to Re: [GENERAL] Trigger documentation? Need more examples.. pleeeze.. ;-)  (Zakkr <zakkr@zf.jcu.cz>)
Responses Re: [GENERAL] Trigger documentation? Need more examples.. pleeeze.. ;-)
List pgsql-general
Zakkr,

I wonder if you read my message.  I am aware of the examples in the contrib/spi
directory, but they aren't enough for me.  I'm looking for a more specific
trigger documentation, or more trigger examples.

I would like to know how, from a trigger C function, can I get the "old" and
"new" value for an updated field.  Is this possible?  How do I do that?

For example, if I do:

update users set username = "clinton" where id = "2400"

When the trigger is activated, is it possible to compare the OLD value and NEW
value of the field "username"?

Did you understand?  ;-)

Thanks!

> > I'm new to PostgreSQL, but I've been using MySQL/mSQL for a long time now.
 I > > switched to PostgreSQL mostly because of it's features: triggers,
specially. > >
>
> Trigger examples ... why not:
> ..see a /postgresql-6.5.1/contrib/spi directory in PostgreSQL source package.
>
>                         Zakkr
--
Henrique Pantarotto
CEPAnet Internet Provider
webmaster / analista de sistemas
Email: scanner@cepa.com.br
Tel: (011) 5506-8477
Cel: (011) 9706-3444
LINUX FRIEND

pgsql-general by date:

Previous
From: Petter Reinholdtsen
Date:
Subject: PostgreSQL order of evaluation
Next
From: Dirk Lutzebaeck
Date:
Subject: backend crashing with INTERSECT / ORDER BY