Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.10.1/8.10.1) with ESMTP id e7KHWem55000 for ; Sun, 20 Aug 2000 13:32:40 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id NAA10470; Sun, 20 Aug 2000 13:31:24 -0400 (EDT) To: ldm@apartia.ch cc: pgsql-sql@postgresql.org Subject: Re: protecting a field after creation In-reply-to: <20000820182933.A2917@styx> References: <20000820182933.A2917@styx> Comments: In-reply-to Louis-David Mitterrand message dated "Sun, 20 Aug 2000 18:29:33 +0200" Date: Sun, 20 Aug 2000 13:31:24 -0400 Message-ID: <10467.966792684@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200008/189 Louis-David Mitterrand 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