| From: | Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> |
|---|---|
| To: | Troels Arvin <troels(at)arvin(dot)dk> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Immutable attributes? |
| Date: | 2003-07-01 16:28:27 |
| Message-ID: | 1057076907.11365.411.camel@camel |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On Tue, 2003-07-01 at 05:59, Troels Arvin wrote:
> Hello,
>
> I have a table like this:
>
> create table test (
> "test_id" serial primary key,
> "created" timestamp with time zone
> default current_timestamp
> check(created = current_timestamp),
> "some_datum" int not null
> );
>
> My question concerns the "created" attribute: I want this to reflect when
> the tuple was craeated; and I want to make sure that the timestamp is not
> wrong. That will work with the above schema. However, I also want to make
> sure that the "crated" attribut for a tuple is not changed once it has
> been set.
>
> I'm thinking about implementing it through a trigger, but is there a
> better way to create such "immutable" attributes?
>
I don't know if it's "better", but this is one of the things people find
the RULE system really handy for. Check the docs, I believe there are
examples of this.
Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Stark | 2003-07-01 16:29:16 | Re: LEAST and GREATEST functions? |
| Previous Message | Bruno Wolff III | 2003-07-01 14:46:03 | Re: help with "delete joins" |