Search Postgresql Archives

This is my first template

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks

Looks like there's something I'm not understanding about date/time queries on a date field.

I have a param query that includes the statement:

AND active_from_date <= $2

where $2 is a well-formed ISO date.

Query works as expected when there are records in the result set. When the result set is empty, PG throws an error:

date/time field value out of range: "2011-4-31"

I'm using the default datestyle setting, which should work here, I think? Experimenting with other settings hasn't helped.

This query runs hundreds of times a day and I don't want the error clogging up my logs. But I don't want to suppress the error as the query is business-critical and I need to know if anything goes wrong.

I'd welcome suggestions as to how I can get this query to run without throwing a date/time error when the result set is empty.

Thanks...

--
Geoff Caplan
Uviva Ltd

begin:vcard
fn:Geoff Caplan
n:Caplan;Geoff
org:Uviva Ltd
adr:Dartington Hall;;Foxhole;Totnes;Devon;TQ9 6EB;UK
email;internet:geoff@xxxxxxxxx
tel;work:01803 840 840
x-mozilla-html:FALSE
url:http://www.uviva.com
version:2.1
end:vcard

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux