From: | David Fetter <david(at)fetter(dot)org> |
---|---|
To: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
Cc: | PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Auto-updated fields |
Date: | 2008-05-09 13:33:04 |
Message-ID: | 20080509133304.GA5601@fetter.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, May 08, 2008 at 08:44:46AM +0200, Martijn van Oosterhout wrote:
> On Wed, May 07, 2008 at 03:04:49PM -0700, David Fetter wrote:
> > 1. Create a generic (possibly overloaded) trigger function,
> > bundled with PostgreSQL, which sets a field to some value. For
> > example, a timestamptz version might set the field to now().
>
> Doesn't the SQL standard GENERATED BY functionality work for this?
> Or won't that handle updates?
It appears to, at least according to 6WD2_02_Foundation_2007-12.pdf :)
4.14.8 Base columns and generated columns
A column of a base table is either a base column or a generated
column. A base column is one that is not a generated column. A
generated column is one whose values are determined by evaluation
of a generation expression, a <value expression> whose declared
type is by implication that of the column. A generation expression
can reference base columns of the base table to which it belongs
but cannot otherwise access SQL data. Thus, the value of the field
corresponding to a generated column in row R is determined by the
values of zero or more other fields of R. A generated column GC
depends on each column that is referenced by a <column reference>
in its generation expression, and each such referenced column is a
parametric column of GC.
Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
From | Date | Subject | |
---|---|---|---|
Next Message | Decibel! | 2008-05-09 13:55:34 | Re: Table inheritance surprise |
Previous Message | Csaba Nagy | 2008-05-09 13:05:09 | Re: constraint exclusion analysis caching |