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

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: help: now() + N is now failing!
Date: 2003-07-29 20:59:06
Message-ID: 20030729122411.B95613-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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).

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Dmitry Tkach 2003-07-29 21:14:18 Re: help: now() + N is now failing!
Previous Message Dmitry Tkach 2003-07-29 20:15:40 Re: help: now() + N is now failing!