Re: what's wrong with my date comparison?

From: "Tena Sakai" <tsakai(at)gallo(dot)ucsf(dot)edu>
To: "Tena Sakai" <tsakai(at)gallo(dot)ucsf(dot)edu>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: what's wrong with my date comparison?
Date: 2007-10-16 18:00:08
Message-ID: FE44E0D7EAD2ED4BB2165071DB8E328C03062CEB@egcrc-ex01.egcrc.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Oooops! I got it.
I was missing quotes.
It must have evaluated 2007-10-02 and used it as a
numerical constant 1995.

Sorry about commotion.

Tena

-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org on behalf of Tena Sakai
Sent: Tue 10/16/2007 10:57 AM
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] what's wrong with my date comparison?

Hi Everybody,

I have a table with a column of timestamp type. It is
known to postgres like this:

name | character varying | not null
value | character varying | not null
datecreated | timestamp without time zone | not null

when I do query

select name, value, datecreated
from mytable
where datecreated > 2007-10-02;

it reports:

name | value | datecreated
----------+----------------------+-------------------------
al_qual | 0 | 2007-08-09 00:06:06.742
srehquan | 3 | 2007-08-09 00:06:06.742
complete | 1 | 2007-08-09 00:06:06.743
al_quan | 0.315924933 | 2007-08-09 00:06:06.742
bsa_qual | 0 | 2007-08-09 00:06:06.743
bsl_qual | 2 | 2007-08-09 00:06:06.743
sh_qual | 0 | 2007-08-09 00:06:06.742
. . . .
. . . .

I don't understand why it thinks August is greater than
October. Can someone please elucidate what is going on?

Regards,

Tena Sakai
tsakai(at)gallo(dot)ucsf(dot)edu

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2007-10-16 18:04:55 Re: what's wrong with my date comparison?
Previous Message Tena Sakai 2007-10-16 17:57:03 what's wrong with my date comparison?