Re: protecting a field after creation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ldm(at)apartia(dot)ch
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: protecting a field after creation
Date: 2000-08-20 17:31:24
Message-ID: 10467.966792684@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Louis-David Mitterrand <cunctator(at)apartia(dot)ch> writes:
> Is there a way (outside of RULEs and TRIGGERs) to make a field
> read-only once it is INSERTed or assigned its default value? I'm
> thinking, for example, of the "created" column that I add to most
> tables, holding the row's creation timestamp.

An on-update trigger seems like a very simple solution here.
You could either copy the old value into the new, or raise an
error if they are different, depending on what you want.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message The Hermit Hacker 2000-08-20 17:59:48 Re: Speed or configuration
Previous Message Louis-David Mitterrand 2000-08-20 16:29:33 protecting a field after creation