Re: help: now() + N is now failing! - Mailing list pgsql-novice

From Stephan Szabo
Subject Re: help: now() + N is now failing!
Date
Msg-id 20030729122411.B95613-100000@megazone.bigpanda.com
Whole thread Raw
In response to Re: help: now() + N is now failing!  (Dmitry Tkach <dmitry@openratings.com>)
Responses Re: help: now() + N is now failing!
List 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 by date:

Previous
From: Dmitry Tkach
Date:
Subject: Re: help: now() + N is now failing!
Next
From: Dmitry Tkach
Date:
Subject: Re: help: now() + N is now failing!