forcing a literal value in a column - Mailing list pgsql-general

From Karsten Hilbert
Subject forcing a literal value in a column
Date
Msg-id 20030513134603.P564@hermes.hilbert.loc
Whole thread Raw
In response to Re: fomatting an interval  (nolan@celery.tssi.com)
Responses 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>)
List 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 by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: create db with -E
Next
From: Karsten Hilbert
Date:
Subject: Re: forcing a literal value in a column