Re: BETWEEN not matching on timestamp value

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "James B(dot) Byrne" <byrnejb(at)harte-lyne(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: BETWEEN not matching on timestamp value
Date: 2009-06-30 17:24:51
Message-ID: 20267.1246382691@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"James B. Byrne" <byrnejb(at)harte-lyne(dot)ca> writes:
> I have encountered an error that, on the face of it, seems to me to
> be inexplicable. I hope that someone here can illuminate the matter
> for me.

> PGError: ERROR: timestamp out of range: "20080809-01-01
> 00:00:00"
> : SELECT * FROM "currency_exchange_rates" WHERE
> (currency_code_base = E'CAD' AND currency_code_quote = E'JPY'
> AND effective_from BETWEEN '20080809-01-01 00:00:00' AND
> '20080809-01-01 23:59:59') ORDER BY currency_code_base,
> currency_code_quote, effective_from DESC

> Now, if I read this aright then, this is telling me that the
> timestamp value I am processing is "20080809-01-01 00:00:00"

No, it's complaining that the constant is out of range --- it's
failing long before it's tried to do any actual BETWEEN comparisons.
Surely you meant something more like 2008-08-09?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2009-06-30 17:45:15 Re: BETWEEN not matching on timestamp value
Previous Message Erik Jones 2009-06-30 17:22:23 Re: