pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Henry Ortega <juandelacruz@gmail.com>
To: pgsql-sql@postgresql.org
Subject: best way to auto-update a field when row is updated
Date: Thu, 10 Mar 2005 15:09:42 -0500
Message-ID: <2bffcc3305031012092fde7dc2@mail.gmail.com> (raw)

I have the following table

FIELD_A        |          FIELD_B          |           TSTAMP
--------------------------------------------------------------------------------------------------------
x                              y                          2005-03-10
14:56:47.456431

TSTAMP = not null default now()

What's the best way to always auto-update TSTAMP to it's
default value whenever the row gets updated?
(e.g. update TABLENAME set FIELD_A='zzz' where FIELD_A='x';
should automatically set TSTAMP to now)



view thread (3+ messages)  latest in thread

Message-ID: <2bffcc3305031012092fde7dc2@mail.gmail.com>
Permalink:  ../2bffcc3305031012092fde7dc2@mail.gmail.com/
Also on:    postgresql.org/message-id/2bffcc3305031012092fde7dc2@mail.gmail.com

 · 

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: juandelacruz@gmail.com
  Subject: Re: best way to auto-update a field when row is updated
  In-Reply-To: <2bffcc3305031012092fde7dc2@mail.gmail.com>

* 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