Re: BUG #1653: Bug in date - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #1653: Bug in date
Date
Msg-id 18058.1115410432@sss.pgh.pa.us
Whole thread Raw
In response to BUG #1653: Bug in date  ("Guilherme" <guilherme.silva@nexxera.com>)
Responses Re: BUG #1653: Bug in date  (Guilherme Silva <guilherme.silva@nexxera.com>)
Re: BUG #1653: Bug in date  (Guilherme Silva <guilherme.silva@nexxera.com>)
List pgsql-bugs
"Guilherme" <guilherme.silva@nexxera.com> writes:
> BILHETAGEM=# select sum(tm_arquivo) from bilhete where
> cd_caixa_postal_principal=1304 AND
> BILHETAGEM-# dt_transacao >= to_date('01042005000000', 'ddmmyyyyHH24MISS')
> AND
> BILHETAGEM-# dt_transacao <= to_date('01042005235959', 'ddmmyyyyHH24MISS');

to_date() produces a date, not a timestamp.  I suspect you are after
to_timestamp.  If dt_transacao is a timestamp, the above will only
select rows that are at exactly midnight of 2005-04-01, because that's
what the date values will promote to.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1651: static date field is not recognized automatically when group by is used
Next
From: Tom Lane
Date:
Subject: Re: BUG #1653: Bug in date