Re: modifying a timestamp in a C trigger

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: ldm(at)apartia(dot)ch, pgsql-hackers(at)postgresql(dot)org
Subject: Re: modifying a timestamp in a C trigger
Date: 2000-08-14 17:45:19
Message-ID: 3.0.1.32.20000814104519.014554a0@mail.pacifier.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 04:47 PM 8/14/00 +0200, Louis-David Mitterrand wrote:
>Hello,
>
>I just finished a new C trigger that updated a "modified" column with
>the current time upon an UPDATE event. It seems to work OK but I just
>wanted to bounce this off you guys to check for some non-kosher stuff or
>better way of doing it. Thanks in advance.

This could easily done in PL/pgSQL. Your C trigger will have to be modified
if the details of trigger or the function call protocol changes, while the
PL/pgSQL source will work forever without change.

And since the expense is in the "update" itself, I'd be surprised if you
could measure any speed difference between the two approaches.

Unless you're doing this to learn how to write C triggers for the heck
of it or to do stuff you can't do in PL/pgSQL, the PL/pgSQL approach is
much better.

- Don Baccus, Portland OR <dhogaza(at)pacifier(dot)com>
Nature photos, on-line guides, Pacific Northwest
Rare Bird Alert Service and other goodies at
http://donb.photo.net.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ross J. Reedstrom 2000-08-14 18:38:58 Re: [GENERAL] +/- Inf for float8's
Previous Message Louis-David Mitterrand 2000-08-14 14:47:33 modifying a timestamp in a C trigger