Re: Comparing dates

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Comparing dates
Дата
Msg-id 10559.1062648692@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Comparing dates  ("John Velman" <velman@cox.net>)
Список pgsql-general
"John Velman" <velman@cox.net> writes:
> When I do a select such as
> SELECT * FROM table WHERE date BETWEEN '2001-12-28' AND '2002-01-28'
> It misses the entry with date '2002-01-28'  (which does exist!).

Uh, what exactly is the datatype of the "date" column?

> The only way I've been able to handle this, so far, is
> in this fashion:
> SELECT * FROM table WHERE
>     date BETWEEN 20011228 - .001 AND 20020128 + .001 ;

I think the odds that this does what you think it does are vanishingly
small :-(.  There's no date-vs-numeric comparison operator.  It's
probably getting interpreted as some bizarre textual comparison.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Index not being used ?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: TCL trigger doesn't work after deleting a column