Обсуждение: Re: [SQL] Date comparisons

Поиск
Список
Период
Сортировка

Re: [SQL] Date comparisons

От
"omid omoomi"
Дата:
hello ,try this :
select * from a where a.cdate < '10-20-1999' ;

regards,
omid omoomi


>From: Rich Ryan <postgres@weblynk.com>
>To: "pgsql-sql@postgresql.org" <pgsql-sql@postgreSQL.org>
>Subject: [SQL] Date comparisons
>Date: Tue, 26 Oct 1999 23:46:04 -0700
>
>I'm trying to do a > < on a date field. Not having any luck. My query looks
>like
>select * from a where a.cdate > Date('10-20-1999');
>I've tried every different date string format I can think of with no 
>dashes,
>colons, different orderings of the month, date, and year, etc. no luck. Any
>hints?
>Thanks,
>Rich
>
>
>
>************
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


Re: [SQL] Date comparisons

От
Tom Lane
Дата:
"omid omoomi" <oomoomi@hotmail.com> writes:
>> I'm trying to do a > < on a date field. Not having any luck.
>> My query looks like
>> select * from a where a.cdate > Date('10-20-1999');

> hello ,try this :
> select * from a where a.cdate < '10-20-1999' ;

Hoo boy, that looks like a nasty little bug.  The first example *should*
work, but indeed it does not.  Examination of the 'explain verbose'
output shows that the parser is converting the function call to
    datetime_date('10-20-1999'::unknown)
which is certainly not going to work --- datetime_date expects a
datetime input, not a text string.  I don't know why it's not choosing
to use date_in as the implementation of Date(), but in any case it
seems to have dropped the ball on coercing "unknown" to "datetime"
as it should have done if it wants to use datetime_date.

6.5.2 and current sources both misbehave like this.

            regards, tom lane