Re: [HACKERS] date/time problem in v6.5.3 and 7.0.0 ...
От | Jose Soares |
---|---|
Тема | Re: [HACKERS] date/time problem in v6.5.3 and 7.0.0 ... |
Дата | |
Msg-id | 38847472.DC3C84AA@sferacarta.com обсуждение исходный текст |
Ответ на | date/time problem in v6.5.3 and 7.0.0 ... (The Hermit Hacker <scrappy@hub.org>) |
Список | pgsql-hackers |
The Hermit Hacker wrote: > I can add days to now(), but not subtract? > > ===================================== > > template1=> select now() + '30 days'; > ?column? > ------------------------------ > Sun Feb 13 22:00:33 2000 AST > (1 row) > > template1=> select now() - '30 days'; > ERROR: Unable to identify an operator '-' for types 'timestamp' and 'unknown' > You will have to retype this query using an explicit cast > template1=> select version(); > version > --------------------------------------------------------------------- > PostgreSQL 7.0.0 on i386-unknown-freebsd4.0, compiled by gcc 2.95.2 > (1 row) > > Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy > Systems Administrator @ hub.org > primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org > > ************ Try using standard names (TIMESTAMP instead of now() and INTERVA) as in: hygea=> select current_timestamp + interval '30 day'; ?column? -------------------------- 17/02/2000 16:00:28.00 CET (1 row) hygea=> select current_timestamp - interval '30 day'; ?column? -------------------------- 19/12/1999 16:00:44.00 CET (1 row) hygea=> select now() - '30 day'; ERROR: Unable to identify an operator '-' for types 'timestamp' and 'unknown' You will have to retype this query usingan explicit cast José
В списке pgsql-hackers по дате отправления: