disallow updates on column or whole table

From: Peter Billen <peter(at)clueless(dot)be>
To: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: disallow updates on column or whole table
Date: 2008-12-10 10:38:57
Message-ID: 493F9C41.6040108@clueless.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

What is the best way to disallow updates on a column of a table, or even
on a whole table itself?

I can write a BEFORE UPDATE trigger which compares old.column_name(s) to
new.column_name(s) and raise an exception if these values are different.

Are there better ways?

Certain properties cannot be changed once inserted. I would like to
enforce that in my database schema.

Thanks in advance. Kind regards,

Peter

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Erwin Moller 2008-12-10 10:47:58 noobquestion: How does Postgres delete 'smart' when deleting with FK contraints?
Previous Message Maximilian Tyrtania 2008-12-10 10:26:57 tcp_keepalives_idle setting