Re: "where x between y and z" for timestamp data types

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: "where x between y and z" for timestamp data types
Дата
Msg-id 1344805643.19209.9.camel@jdavis
обсуждение исходный текст
Ответ на "where x between y and z" for timestamp data types  (M Q <thekaib@gmail.com>)
Ответы Re: "where x between y and z" for timestamp data types  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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




В списке pgsql-novice по дате отправления:

Предыдущее
От: M Q
Дата:
Сообщение: "where x between y and z" for timestamp data types
Следующее
От: Tom Lane
Дата:
Сообщение: Re: "where x between y and z" for timestamp data types