Re: help: now() + N is now failing!

Поиск
Список
Период
Сортировка
От Dmitry Tkach
Тема Re: help: now() + N is now failing!
Дата
Msg-id 3F26C768.4040005@openratings.com
обсуждение исходный текст
Ответ на help: now() + N is now failing!  ("Mel Jamero" <mel@gmanmi.tv>)
Ответы Re: help: now() + N is now failing!  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-novice
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).

> (the other
>does, but it was a more rediculous example using two casts - I don't
>see much stretch from allowing all casts implicitly to allowing multiple
>casts really in the abstract anyway)
>
Well... I don't know about the 'stretch' :-)
I am just trying to use the analogy with programming language (like C++,
or Java) that allow function/operator overloading - they do allow
single-step casts (as long as it is no ambigous), but not multiple step
... they also allow downcasting (e.g. using a superclass of the declared
argument argument), even for "primitive" types actually (it will
implicitly coerce a double into an int for example if you send it into a
function that expects an int, even though it will complain about it
first, which, BTW I believe to be inconsistent - if you can coerce a
subclass into a superclass, there is not much difference in casting
double into an int really)...

So, I just have a little trouble understanding why postgres cannot use
those same rules, and has instead to "reinvent the bycicle" and come up
with some of its own...

Dima




В списке pgsql-novice по дате отправления:

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: switch statement in plpgsql
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: help: now() + N is now failing!