Re: IMMUTABLE columns in tables?

From: Chris Browne <cbbrowne(at)acm(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: IMMUTABLE columns in tables?
Date: 2010-06-15 15:54:47
Message-ID: 877hm0p9yw.fsf@cbbrowne-laptop.afilias-int.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

avbidder(at)fortytwo(dot)ch (Adrian von Bidder) writes:
> Heyho!
>
> (Ok, seems to be feature wish day ...)
>
> I was wondering if others would find an IMMUTABLE (or whatever) column
> constraint useful as well. Semantics would (obviously?) be to disallow
> changing the value of this column after insert.
>
> I realize that this is possible via triggers, and with the recent
> possibility of having triggers fire only on changes to certain columns it's
> even (presumably) not much runtime overhead, but creating triggers is very
> verbose and doesn't make the db schema very readable.

I'd like that feature, and I don't think it takes too much arguing to
get to the point that a declarative "IMMUTABLE" control is rather less
opaque than someone saying "oh, you could just create a trigger
running PL/LOLCODE to do that!"

I thought that this was on the Todo list, but I don't see it.
<http://wiki.postgresql.org/wiki/Todo>

If you're keen on getting it onto the ToDo list, the argumentation
process would be made easier if the material about this included
answers to a couple more questions:
- What do other databases use as syntax for this?
- Does SQL standard have anything to say about how this sort
of thing ought to be declared?
--
select 'cbbrowne' || '@' || 'cbbrowne.com';
http://cbbrowne.com/info/internet.html
"MS apparently now has a team dedicated to tracking problems with
Linux and publicizing them. I guess eventually they'll figure out
this back fires... ;)" -- William Burrow <aa126(at)DELETE(dot)fan(dot)nb(dot)ca>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2010-06-15 16:19:50 Re: Problem serving one-click installer to Syria
Previous Message maarten 2010-06-15 15:54:35 integer to little endian conversion