Re: protecting a field after creation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: protecting a field after creation
Дата
Msg-id 10467.966792684@sss.pgh.pa.us
обсуждение исходный текст
Ответ на protecting a field after creation  (Louis-David Mitterrand <cunctator@apartia.ch>)
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: Louis-David Mitterrand
Дата:
Сообщение: protecting a field after creation
Следующее
От: The Hermit Hacker
Дата:
Сообщение: Re: Speed or configuration