pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedprotecting a field after creation
2+ messages / 2 participants
[nested] [flat]
* protecting a field after creation
@ 2000-08-20 16:29 Louis-David Mitterrand <cunctator@apartia.ch>
0 siblings, 1 reply; 2+ messages in thread
From: Louis-David Mitterrand @ 2000-08-20 16:29 UTC (permalink / raw)
To: pgsql-sql
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's physics.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: protecting a field after creation
@ 2000-08-20 17:31 Tom Lane <tgl@sss.pgh.pa.us>
parent: Louis-David Mitterrand <cunctator@apartia.ch>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2000-08-20 17:31 UTC (permalink / raw)
To: ldm@apartia.ch; +Cc: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-08-20 17:31 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-08-20 16:29 protecting a field after creation Louis-David Mitterrand <cunctator@apartia.ch>
2000-08-20 17:31 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox