Search Postgresql Archives

Re: IMMUTABLE columns in tables?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15/06/2010 2:41 AM, Adrian von Bidder wrote:
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.

Where possible, I do this with column priveleges, ensuring that nobody (except the superuser) has UPDATE rights for that column. It's short and simple, though it's only effective if the regular user isn't the same as the table owner.

It'd be nice to have something stronger in the form of a column qualifier (akin to NOT NULL), though, and much easier to show to be correct. Column privs may be bypassed by a superuser (or a suitably privileged SECURITY DEFINER function/trigger), and triggers can have "interesting" interactions between them that make it hard to feel confident in the effect.

--
Craig Ringer

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux