Re: BUG #1653: Bug in date

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Guilherme" <guilherme(dot)silva(at)nexxera(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1653: Bug in date
Date: 2005-05-06 20:13:52
Message-ID: 18058.1115410432@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Guilherme" <guilherme(dot)silva(at)nexxera(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Guilherme Silva 2005-05-06 20:35:43 Re: BUG #1653: Bug in date
Previous Message Tom Lane 2005-05-06 20:09:12 Re: BUG #1651: static date field is not recognized automatically when group by is used