Re: [GENERAL] querying the age of a row

2007-06-08 Thread Alban Hertroys
John D. Burger wrote: > In any event, you say you need to know when a row is less than 24 hours > old - that is presumably not an issue for these old rows. I would add > the column as suggested, but set it to some time in the past for the > existing rows. Or, you can set it to NULL, appropriately

Re: [GENERAL] querying the age of a row

2007-06-07 Thread John D. Burger
Lonni J Friedman wrote: I have a need to determine which rows in a specific table are less than 24 hours old. I've tried (and failed) to do this with the age() function. And on the suggestion of a timestamp column with DEFAULT NOW(): Unfortunately, its too late now. The database (and its ta

Re: [GENERAL] querying the age of a row

2007-06-07 Thread Alvaro Herrera
Lonni J Friedman escribió: > Unfortunately, its too late now. The database (and its tables) have > been around for a while, so even if I added this column, it wouldn't > help me for the thousands of pre-existing rows. Thanks though. The answer to your original question is "you can't". That info

Re: [GENERAL] querying the age of a row

2007-06-07 Thread brian
Lonni J Friedman wrote: Unfortunately, its too late now. The database (and its tables) have been around for a while, so even if I added this column, it wouldn't help me for the thousands of pre-existing rows. Thanks though. Please don't top-post. Assuming that the majority of the pre-existi

Re: [GENERAL] querying the age of a row

2007-06-07 Thread Lonni J Friedman
Unfortunately, its too late now. The database (and its tables) have been around for a while, so even if I added this column, it wouldn't help me for the thousands of pre-existing rows. Thanks though. On 6/7/07, codeWarrior <[EMAIL PROTECTED]> wrote: Interesting issue -- I have usually solved

Re: [GENERAL] querying the age of a row

2007-06-07 Thread codeWarrior
Interesting issue -- I have usually solved this by adding a specific field to each table with a default timestamp of NOW()... When you: CREATE TABLE tbl ( blah... blah create_dt TIMESTAMP NOT NULL DEFAULT NOW() ); each and every record now has a timestamp of exactly when th