Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Hackers > Re: Auto-update...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 9 Topic 9323 of 10966
Post > Topic >>

Re: Auto-updated fields

by david@[EMAIL PROTECTED] (David Fetter) May 9, 2008 at 06:33 AM

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@[EMAIL PROTECTED]
> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@[EMAIL PROTECTED]
 to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
 




 9 Posts in Topic:
Auto-updated fields
david@[EMAIL PROTECTED]   2008-05-07 15:04:49 
Re: Auto-updated fields
tgl@[EMAIL PROTECTED] (T  2008-05-08 00:41:38 
Re: Auto-updated fields
kleptog@[EMAIL PROTECTED]  2008-05-08 08:44:46 
Re: Auto-updated fields
zb@[EMAIL PROTECTED] (Zo  2008-05-08 11:56:28 
Re: Auto-updated fields
zb@[EMAIL PROTECTED] (Zo  2008-05-08 12:03:55 
Re: Auto-updated fields
david@[EMAIL PROTECTED]   2008-05-09 06:33:04 
Re: Auto-updated fields
xzilla@[EMAIL PROTECTED]   2008-05-08 11:20:08 
Re: Auto-updated fields
josh@[EMAIL PROTECTED] (  2008-05-08 10:33:26 
Re: Auto-updated fields
hannu@[EMAIL PROTECTED]   2008-05-08 23:40:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 12:30:56 CST 2008.