Thread: protecting a field after creation
Hello, 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. Thanks in advance, -- Louis-David Mitterrand - ldm@apartia.org - http://www.apartia.org Murphy's Guide to Science: If it's green or squirms, it's biology. If it stinks, it's chemistry. If it doesn't work, it'sphysics.
Louis-David Mitterrand <cunctator@apartia.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