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

Re: pgsql DATE

From: "Andras Balogh" <abalogh(at)grafx(dot)ro>
To: "Martijn van Oosterhout" <kleptog(at)cupid(dot)suninternet(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: pgsql DATE
Date: 2000-04-27 08:03:13
Message-ID: 012301bfb01f$0956ee30$0200a8c0@grafx.ro (view raw or flat)
Thread:
Lists: pgsql-general
Hi,

Thank You for your reply.
BUT as i mentioned the date_time field is VARCHAR.
So if i use:
date >= '01/4/2000' and date < '01/5/2000'

this won't compare the dates it will compare Strings.
so '02/4/2000' will be GREATER than '01/5/2000'.

That is why i need a DATE TYPE for my field that can be used to create an
index.

So any other ideas?




----- Original Message -----
From: Martijn van Oosterhout <kleptog(at)cupid(dot)suninternet(dot)com>
To: Andras Balogh <abalogh(at)grafx(dot)ro>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Wednesday, April 26, 2000 5:41 PM
Subject: Re: [GENERAL] pgsql DATE


> Andras Balogh wrote:
> > So i am looking a date type that would allow me to do the following with
one
> > (or a few) query
> > (and to be fast too):
> > -select all records for a given month
> > -select the count of records where the hour is 14.
> > -select  all the records from the 7th week.
> > -select count of records  where the day of the week is Sunday.
> > etc.
>
> How about you write your queries like:
>
> date >= '01/4/2000' and date < '01/5/2000'
>
> or equivalent. It allows use of the index but works the same.
> Except for the day is Sunday though...
> --
> Martijn van Oosterhout <kleptog(at)cupid(dot)suninternet(dot)com>
> http://cupid.suninternet.com/~kleptog/


In response to

Responses

pgsql-general by date

Next:From: Elmar.HanekeDate: 2000-04-27 08:38:55
Subject: sequences and Transactions
Previous:From: Peter EisentrautDate: 2000-04-27 08:02:32
Subject: Re: [HACKERS] pgsql/php3/apache authentication

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