Re: [DOCS] [SQL] Update timestamp on update

2005-10-13 Thread Mike Diehl
Is a working example something that people would like to see? Or is this considered a good use of research time? On Thursday 13 October 2005 11:20 am, Jim C. Nasby wrote: > On Wed, Oct 12, 2005 at 10:52:04PM -0400, Tom Lane wrote: > > Jeff Williams <[EMAIL PROTECTED]> writes: > > > Thanks. Trigg

Re: [DOCS] [SQL] Update timestamp on update

2005-10-13 Thread Jim C. Nasby
On Wed, Oct 12, 2005 at 10:52:04PM -0400, Tom Lane wrote: > Jeff Williams <[EMAIL PROTECTED]> writes: > > Thanks. Triggers was my first thought, but chapter 35 on Triggers didn't > > really indicate a way I could do this easily and scared me with a lot of > > c code. > > Yeah. This is a documenta

Re: [SQL] Update timestamp on update

2005-10-13 Thread Andrew Sullivan
On Wed, Oct 12, 2005 at 10:52:04PM -0400, Tom Lane wrote: > the documentation of the "core" system shouldn't rely on them ... but > that leaves us presenting C-code triggers as the only examples in > chapter 35. There is a paragraph in there suggesting you go look at > the PL languages first, but

Re: [SQL] Update timestamp on update

2005-10-12 Thread Michael Glaesemann
On Oct 13, 2005, at 11:52 , Tom Lane wrote: Jeff Williams <[EMAIL PROTECTED]> writes: Thanks. Triggers was my first thought, but chapter 35 on Triggers didn't really indicate a way I could do this easily and scared me with a lot of c code. Yeah. This is a documentation issue that's bo

Re: [SQL] Update timestamp on update

2005-10-12 Thread Stewart Ben (RBAU/EQS4) *
> The problem is that we treat the PL languages as add-ons and therefore > the documentation of the "core" system shouldn't rely on them ... but > that leaves us presenting C-code triggers as the only examples in > chapter 35. There is a paragraph in there suggesting you go look at > the PL langu

Re: [SQL] Update timestamp on update

2005-10-12 Thread Tom Lane
Jeff Williams <[EMAIL PROTECTED]> writes: > Thanks. Triggers was my first thought, but chapter 35 on Triggers didn't > really indicate a way I could do this easily and scared me with a lot of > c code. Yeah. This is a documentation issue that's bothered me for awhile. The problem is that we treat

Re: [SQL] Update timestamp on update

2005-10-12 Thread Jeff Williams
Tom Lane wrote: >Jeff Williams <[EMAIL PROTECTED]> writes: > > >>last_status_change timestamp DEFAULT now() >> >> > > > >>What I would like is that whenever the status is changed the >>last_status_change timestamp is updated to the current time. >> >> > >For this you use an ON UPDA

Re: [SQL] Update timestamp on update

2005-10-12 Thread Tom Lane
Jeff Williams <[EMAIL PROTECTED]> writes: > last_status_change timestamp DEFAULT now() > What I would like is that whenever the status is changed the > last_status_change timestamp is updated to the current time. For this you use an ON UPDATE trigger; rules are not a good way to solve it. Se

[SQL] Update timestamp on update

2005-10-12 Thread Jeff Williams
I have a table like: CREATE TABLE products ( id int, status int, last_status_change timestamp DEFAULT now() ); What I would like is that whenever the status is changed the last_status_change timestamp is updated to the current time. I have had a look at the rules and what I want would