Re: [GENERAL] handing created and updated fields

2005-01-10 Thread Jim C. Nasby
On Mon, Jan 10, 2005 at 11:16:03AM -0500, Sven Willenberger wrote: > These could also be combined into one trigger since they are nearly > identical anyway: > > CREATE FUNCTION combined_trigger() RETURNS TRIGGER AS ' > BEGIN >NEW.update := CURRENT_TIMESTAMP; >IF TG_OP = ''INSERT'' THEN >

Re: [GENERAL] handing created and updated fields

2005-01-10 Thread Sven Willenberger
On Mon, 2005-01-10 at 15:45 +0100, Daniel Martini wrote: > Hi, > > Citing "Jim C. Nasby" <[EMAIL PROTECTED]>: > > ON INSERT: force created and updated to be current_timestamp > > ON UPDATE: deny updated created. force updated to be set to > > current_timestamp > [snip] > > Does anyone have an exam

Re: [GENERAL] handing created and updated fields

2005-01-10 Thread Daniel Martini
Hi, Citing "Jim C. Nasby" <[EMAIL PROTECTED]>: > ON INSERT: force created and updated to be current_timestamp > ON UPDATE: deny updated created. force updated to be set to > current_timestamp [snip] > Does anyone have an example of the best way to handle this scenario? Something along the lines o

Re: [GENERAL] handing created and updated fields

2005-01-10 Thread Martijn van Oosterhout
On Mon, Jan 10, 2005 at 05:28:47AM -0600, Jim C. Nasby wrote: > I think I saw something posted about this recently, but I can't find it > in the archives now. :( > > I want to have created and updated fields in a table that are kept > up-to-date by the database and can't be changed accidentally. I

[GENERAL] handing created and updated fields

2005-01-10 Thread Jim C. Nasby
I think I saw something posted about this recently, but I can't find it in the archives now. :( I want to have created and updated fields in a table that are kept up-to-date by the database and can't be changed accidentally. I think this can be done with rules, but I'm not sure of the best way to