Re: using between with dates - Mailing list pgsql-general

From Tom Lane
Subject Re: using between with dates
Date
Msg-id 11098.1272550563@sss.pgh.pa.us
Whole thread Raw
In response to using between with dates  (Geoffrey <lists@serioustechnology.com>)
Responses Re: using between with dates
List pgsql-general
Geoffrey <lists@serioustechnology.com> writes:
> ship_date between '04/30/2010' AND '04/30/2010' + 14
> ERROR:  invalid input syntax for integer: "04/30/2010"

> Can I use between with dates?

The problem with that is the parser has no reason to treat the strings
as dates, at least not till it comes to consider the BETWEEN
comparisons, which is too late to help in resolving the addition
in the subexpression (data types are determined bottom-up).
This'd work:

 ship_date between '04/30/2010' AND '04/30/2010'::date + 14

            regards, tom lane

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: using between with dates
Next
From: "sandeep prakash dhumale"
Date:
Subject: Re: Re: [GENERAL] [SQL] Tsearch not searching 'Y'