Re: New column modifier?

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: John McKown <john(dot)archie(dot)mckown(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: New column modifier?
Date: 2015-04-29 18:05:47
Message-ID: CANu8FiyK6WkMsfOCmmXtGzVXurzjq1Lso_hMJ=w+POT1TfN2dQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

What you suggest is a new column type, and that would be something that
needs to be reviewed and implemented by the PostgreSQL developers. Since it
is not a SQL standard, I doubt it has much chance of implementation. That
being said, you should understand that all triggers require the need for an
associated trigger function. A simpler way to accomplish "WORM" is with a
RULE.
EG:
CREATE RULE table_worm AS ON UPDATE TO your_table WHERE NEW.your_column <>
OLD your_column DO NOTHING.

http://www.postgresql.org/docs/9.3/interactive/sql-createrule.html

On Wed, Apr 29, 2015 at 1:03 PM, John McKown <john(dot)archie(dot)mckown(at)gmail(dot)com>
wrote:

> I am wondering about useful something might be. So I hope ya'll don't mind
> me throwing out for feedback. I am fairly good with standard SQL, but not
> the more advanced DBA things such as TRIGGERs. I am reading good book,
> "PostgreSQL Server Programming" to increase my knowledge. The section that
> I'm on now is about triggers. And how to use them to enforce a "read only"
> column. So I'm wondering if such is very common? I can see some uses for it
> with things which "should not change", such as a system generated date/time
> in an audit log. Given how much PostgreSQL extends beyond the ANSI
> standard, I'm wondering if a new column modifier, perhaps "WORM" (Write
> Once, Read Many) might be of any real use. Or is this "need" just not
> prevalent enough to require such a thing?
>
> just thinking. But maybe not productively.
>
> --
> If you sent twitter messages while exploring, are you on a textpedition?
>
> He's about as useful as a wax frying pan.
>
> 10 to the 12th power microphones = 1 Megaphone
>
> Maranatha! <><
> John McKown
>

--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John McKown 2015-04-29 18:08:57 Re: New column modifier?
Previous Message Joshua D. Drake 2015-04-29 18:05:35 Re: New column modifier?