| From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
|---|---|
| To: | M Q <thekaib(at)gmail(dot)com> |
| Cc: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: "where x between y and z" for timestamp data types |
| Date: | 2012-08-12 21:07:23 |
| Message-ID: | 1344805643.19209.9.camel@jdavis |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
On Sun, 2012-08-12 at 11:52 -0700, M Q wrote:
> Hi,
>
>
> I'm having trouble creating a function with a "where x between y and
> z" for timestamp data types.
First, I'd like to suggest that you look at Range Types in the 9.2 beta,
which might be applicable to your problem:
http://www.postgresql.org/about/news/1405/
http://www.postgresql.org/docs/9.2/static/rangetypes.html
>
> If I hardcode the values for y and z, my function works fine and
> returns quickly (~80ms). If I parameterize y and z (i.e. use $1, $2),
> then the function doesn't seem to return (killed query after waiting >
> 30 seconds)
>
>
> Example:
> I have two tables with timestamp data.
I briefly tried your example and I didn't see a problem. Can you provide
some sample data that illustrates your problem? Also, is the "date"
field a date or a timestamp? And why are the upper and lower bounds of
the BETWEEN identical?
Regards,
Jeff Davis
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2012-08-12 21:28:24 | Re: "where x between y and z" for timestamp data types |
| Previous Message | M Q | 2012-08-12 18:52:22 | "where x between y and z" for timestamp data types |