pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martin Marques <martin@bugs.unl.edu.ar>
To: pgsql-sql@postgresql.org
Subject: defaults on updates
Date: Sat, 1 Nov 2003 10:49:17 -0300
Message-ID: <200311011049.17325.martin@bugs.unl.edu.ar> (raw)

Hi,
I'm trying to make some sort of function, rule, trigger, or what ever that 
would be capable of modifing my table on an update.

Basically, I have 5 fields, one being a PK (SERIAL), 3 with information, and 
the last one a timestamp field that will show the last time the register was 
modified (tmodif which has a DEFAULT CURRENT_TIMESTAMP).

Now, eveytime someone modifys any, or all of the 3 information fields, I want 
the tmodif field of that register to be set to now(). I tried with rules, but 
just didn't work (obviously, and not so), even with INSTEAD.

The only way I see of doing it is through a view/rule, but I would leave that 
as the last resource.

Any ideas?

-- 
 10:43:01 up 10 days, 18:05,  4 users,  load average: 0.95, 0.44, 0.35
-----------------------------------------------------------------
Martín Marqués        | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
             Universidad Nacional
                  del Litoral
-----------------------------------------------------------------




view thread (2+ messages)  latest in thread

Message-ID: <200311011049.17325.martin@bugs.unl.edu.ar>
Permalink:  ../200311011049.17325.martin@bugs.unl.edu.ar/
Also on:    postgresql.org/message-id/200311011049.17325.martin@bugs.unl.edu.ar

 · 

reply

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: martin@bugs.unl.edu.ar
  Subject: Re: defaults on updates
  In-Reply-To: <200311011049.17325.martin@bugs.unl.edu.ar>

* 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