Re: Sorting dates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org, Hershel Fisch <hershrev(at)syp2u4c(dot)com>
Subject: Re: Sorting dates
Date: 2009-05-15 14:11:18
Message-ID: 2646.1242396678@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> On Friday 15 May 2009 01:07:11 Hershel Fisch wrote:
>> Hi, I realized that sorting date is done like text and not numeric (dates)
>> e.g. SELELCT * FROM database_name ORDER BY date ASC
>>
>> Return order
>>
>> 3/02/09
>> 4/19/09
>> 4/2/09

> This report would make a lot more sense if you posted your schema definition.

I'd bet a good deal that the "date" column isn't a datetime type at all,
but text or varchar.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Dunstan 2009-05-15 14:17:36 Re: [HACKERS] Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file
Previous Message Simon Riggs 2009-05-15 14:10:42 Re: [HACKERS] Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file