Re: querying the age of a row

Поиск
Список
Период
Сортировка
От Sean Davis
Тема Re: querying the age of a row
Дата
Msg-id 4668533A.5010003@mail.nih.gov
обсуждение исходный текст
Ответ на querying the age of a row  ("Lonni J Friedman" <netllama@gmail.com>)
Ответы Re: querying the age of a row  ("Lonni J Friedman" <netllama@gmail.com>)
Список pgsql-novice
Lonni J Friedman wrote:
> Greetings,
> I've got a PostgreSQL-8.1.x database on a Linux box.  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.  From what
> I can tell, age() only has granularity down to days, and seems to
> assume that anything matching today's date is less than 24 hours old,
> even if there are rows from yesterday's date that existed less than 24
> hours ago.
>
> I've googled on this off and on for a few days, and have come up dry.
> Someone on a different list suggested that I add a column that get
> now() each time a new row is inserted, but that unfortunately won't
> help me for all the pre-existing rows in this database.
>
> At any rate, is there a reliable way of querying a table for rows
> which have existed for a specific period of time?
>

So your table has no date or time stored in it at all?  If not, then you
cannot do the query that you are suggesting.

Sean

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Lonni J Friedman"
Дата:
Сообщение: querying the age of a row
Следующее
От: "Lonni J Friedman"
Дата:
Сообщение: Re: querying the age of a row