forcing a literal value in a column

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема forcing a literal value in a column
Дата
Msg-id 20030513134603.P564@hermes.hilbert.loc
обсуждение исходный текст
Ответ на Re: fomatting an interval  (nolan@celery.tssi.com)
Ответы Re: forcing a literal value in a column  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Re: forcing a literal value in a column  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
Hello all,

in my audit trail tables I want two columns to _always_ be
CURRENT_USER/CURRENT_TIMESTAMP.

I am currently doing this:
 ...
 modified_by name not null default CURRENT_USER check(modified_by=CURRENT_USER),
 ...
(respective for CURRENT_TIMESTAMP)

I know this can also be achieved with a trigger on insert/update.
However, I'd like to know what is the "PostgreSQL way" of
doing this ? Do I achieve what I want with my above solution ?
It seems to work but feels clunky.

I am sure this has been discussed before on the mailing lists
but despite my search I have not been able to locate the
threads. Please point me to the keywords I need to use for the
search to succeed.

Thanks,
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: create db with -E
Следующее
От: Karsten Hilbert
Дата:
Сообщение: Re: forcing a literal value in a column