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 7 of 9 Topic 9323 of 10122
Post > Topic >>

Re: Auto-updated fields

by xzilla@[EMAIL PROTECTED] (Robert Treat) May 8, 2008 at 11:20 AM

On Thursday 08 May 2008 00:27:10 Tino Wildenhain wrote:
> David Fetter wrote:
> > Folks,
> >
> > A co-worker pointed out to me that MySQL has a feature that, properly
> > implemented and maybe extended, could be handy, namely what MySQL
> > calls a "timestamp" field, so here's a proposal:
> >
> > 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().
> >
> > 2.  Have some kind of pre-processing of CREATE and ALTER statements on
> > tables which would attach the above function to the field at hand,
> > something like:
> >
> > CREATE TABLE foo(
> >     last_updated TIMESTAMPTZ_UPDATED(),
> >     ...
> > );
> >
> > which would turn last_updated into a TIMESTAMPTZ with the expected
> > behavior on UPDATEs.
> >
> > What do folks think of this idea?
>
> Having the pre defined triggers at hand could be useful, especially
> for people not writing triggers so often to get used to it but I'm
> really not happy with the idea of magic preprocessing.
>
> I guess this is commonly used with timestamp fields so why not
> include a receipe to the docs under examples for timestamp which
> shows how to create and use a trigger?
>

I have a generic version of this in pagila. 

-- 
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL

-- 
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 Sun Sep 7 13:03:00 CDT 2008.