Re: [HACKERS] date/time problem in v6.5.3 and 7.0.0 ...
От | Don Baccus |
---|---|
Тема | Re: [HACKERS] date/time problem in v6.5.3 and 7.0.0 ... |
Дата | |
Msg-id | 3.0.1.32.20000114181256.0109cb00@mail.pacifier.com обсуждение исходный текст |
Ответ на | date/time problem in v6.5.3 and 7.0.0 ... (The Hermit Hacker <scrappy@hub.org>) |
Список | pgsql-hackers |
At 10:02 PM 1/14/00 -0400, 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(); donb=> select now()-'30 days'::reltime; ?column? ---------------------- 1999-12-15 18:13:18-08 (1 row) donb=> select now()-'30 days'; ERROR: Unable to identify an operator '-' for types 'timestamp' and 'unknown' You will have to retype this query usingan explicit cast donb=> As a relative newcomer, I too have found dates a bit confusing and my solution has been to cast like crazy rather than guess what will happen if I don't :) - Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert Serviceand other goodies at http://donb.photo.net.
В списке pgsql-hackers по дате отправления: