Skip site navigation (1) Skip section navigation (2)

Re: [SQL] Date comparisons

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: pgsql-sql(at)postgreSQL(dot)org, pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: [SQL] Date comparisons
Date: 1999-10-27 14:28:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugspgsql-sql
"omid omoomi" <oomoomi(at)hotmail(dot)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
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

pgsql-bugs by date

Next:From: David SauerDate: 1999-10-27 19:17:27
Subject: problem with date
Previous:From: Richard GinsburgDate: 1999-10-26 21:40:26
Subject: Re: Pool Cues and Billiards Accessories 8096

pgsql-sql by date

Next:From: Rich RyanDate: 1999-10-28 06:34:16
Subject: Setting default row value after select into table
Previous:From: Rich RyanDate: 1999-10-27 06:46:04
Subject: Date comparisons

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group