| От | Tom Lane |
|---|---|
| Тема | Re: what's wrong with my date comparison? |
| Дата | |
| Msg-id | 23446.1192568036@sss.pgh.pa.us обсуждение |
| Ответ на | Re: what's wrong with my date comparison? ("Tena Sakai" <tsakai@gallo.ucsf.edu>) |
| Список | pgsql-sql |
"Tena Sakai" <tsakai@gallo.ucsf.edu> writes:
> I was missing quotes.
> It must have evaluated 2007-10-02 and used it as a
> numerical constant 1995.
Actually, what you got was a *textual* comparison between '1995' and
the timestamp converted to text, which makes even less sense.
FWIW, as of PG 8.3 you'll get an error:
regression=# select * from timestamp_tbl where d1 > 2007-10-02;
ERROR: operator does not exist: timestamp without time zone > integer
LINE 1: select * from timestamp_tbl where d1 > 2007-10-02; ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
We've seen too many people get burnt by variants of this problem...
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера