pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Troels Arvin <troels@arvin.dk>
To: pgsql-sql@postgresql.org
Subject: Immutable attributes?
Date: Tue, 01 Jul 2003 11:59:24 +0200
Message-ID: <pan.2003.07.01.09.59.23.580853@arvin.dk> (raw)

Hello,

I have a table like this:

create table test (
  "test_id" serial primary key,
  "created" timestamp with time zone
     default current_timestamp
     check(created = current_timestamp),
  "some_datum" int not null
);

My question concerns the "created" attribute: I want this to reflect when
the tuple was craeated; and I want to make sure that the timestamp is not
wrong. That will work with the above schema. However, I also want to make
sure that the "crated" attribut for a tuple is not changed once it has
been set.

I'm thinking about implementing it through a trigger, but is there a
better way to create such "immutable" attributes?

/Troels





view thread (3+ messages)  latest in thread

Message-ID: <pan.2003.07.01.09.59.23.580853@arvin.dk>
Permalink:  ../pan.2003.07.01.09.59.23.580853@arvin.dk/
Also on:    postgresql.org/message-id/pan.2003.07.01.09.59.23.580853@arvin.dk

 · 

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: troels@arvin.dk
  Subject: Re: Immutable attributes?
  In-Reply-To: <pan.2003.07.01.09.59.23.580853@arvin.dk>

* 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