Re: help: now() + N is now failing!
От | Stephan Szabo |
---|---|
Тема | Re: help: now() + N is now failing! |
Дата | |
Msg-id | 20030729122411.B95613-100000@megazone.bigpanda.com обсуждение исходный текст |
Ответ на | Re: help: now() + N is now failing! (Dmitry Tkach <dmitry@openratings.com>) |
Ответы |
Re: help: now() + N is now failing!
|
Список | pgsql-novice |
On Tue, 29 Jul 2003, Dmitry Tkach wrote: > Stephan Szabo wrote: > > >The first doesn't, date_pli('foo', 2) that's just text->date > > > But you can't cast 'foo' into date, can you? I mean, there is a cast, > but it will fail, right. > And if you used a valid date textual representation, then, I don't see > any reason why > date_pli ('29/07/03', 2) should not work > > And, as a matter of fact, it *does*, unless you add '::text' to it (in > 7.3 - 7.2 is still OK with it). That's because it's actually unknown, not text. But, should date_pli(textcolumn, 2) work if and only if all the values of the column happen to be date like? That's pretty brittle and even more so since there's no obvious conversion being done. You use an example of C++ and inheritance, but Timestamp is not a subclass of Date or vice versa. Effectively we have a Date(Timestamp) explicit constructor. You can't call a date expecting function with a timestamp because the conversion is not legal unless explicitly made. And C++ at least does allow multiple conversions, just not multiple user-defined conversions (for example int->double, double->classtype is allowed).
В списке pgsql-novice по дате отправления: