Re: small bug in op + between datetime and integer
От | Dennis Björklund |
---|---|
Тема | Re: small bug in op + between datetime and integer |
Дата | |
Msg-id | Pine.LNX.4.44.0308170720240.15267-100000@zigo.dhs.org обсуждение исходный текст |
Ответ на | Re: small bug in op + between datetime and integer (Bruce Momjian <pgman@candle.pha.pa.us>) |
Список | pgsql-bugs |
On Sun, 17 Aug 2003, Bruce Momjian wrote: > Anyone have an idea on this one? > > > It is maybe not bug, but I didn't find any warning about this behavior. > > > > select current_date + 1; -- ok > > select 1 + current_date; -- not > > > > ERROR: operator does not exist: integer + date > > HINT: No operator matches the given name and argument type(s). You may > > need to add explicit typecasts. It's not a bug. The operator + has one definition of the type (date,integer) -> date but there is no definition for (integer,date) -> date Instead of integer one can also have an interval. So if you start with a date you can add an interval to it. But if you start with a time interval you can not add a date to it. What would it mean to add a date to something? I have no idea. Well, that's the logic behind the current behaviour. It would of course not be difficult to add a definition of + with the integer first and the date as the second argument. To me it's not much of an improvement, but it's not for me to decide. The postgresql operator + is not the same as the mathematical operator + and it does not have the same properties. -- /Dennis
В списке pgsql-bugs по дате отправления: