Read-only attributes

From: Michael Klatt <mdklatt(at)ou(dot)edu>
To: pgsql-novice(at)postgresql(dot)org
Subject: Read-only attributes
Date: 2002-02-11 22:00:12
Message-ID: NCBBLFLGLEIDHCJLONHNMEGJFHAA.mdklatt@ou.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have a table where one of the attributes is the time a row was inserted:
'updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP'.

Is there a way to define this attribute so that a user cannot override the
default value? I have tried this constraint, but it fails for any INSERT:
'updated ... CHECK (updated = CURRENT_TIMESTAMP)'.

___________________________________
Michael Klatt

University of Oklahoma
Environmental Verification and Analysis Center
710 Asp Avenue, Suite 8
Norman, OK 73069

405.447.8412
405.447.8455 FAX
http://www.evac.ou.edu/

"I'm a great motivator. Everyone says they have to work twice as hard when
I'm around."

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2002-02-11 23:13:11 Re: Convert from Mysql to Postgresql
Previous Message Brian Johnson 2002-02-11 21:53:30 Convert from Mysql to Postgresql