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

This is my first template

From: Geoff Caplan <geoff(at)uviva(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: This is my first template
Date: 2009-04-21 11:02:02
Message-ID: 200904211103.n3LB329b023342@rs48.luxsci.com (view raw or flat)
Thread:
Lists: pgsql-general
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


Attachment: geoff.vcf
Description: text/x-vcard (233 bytes)

Responses

pgsql-general by date

Next:From: Sam MasonDate: 2009-04-21 11:34:03
Subject: Re: This is my first template
Previous:From: Albe LaurenzDate: 2009-04-21 10:36:44
Subject: Re: trouble with to_char('L')

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