BUG #6512: Bug with prepared statement and timestamp + interval

Поиск
Список
Период
Сортировка
От stefano.baccianella@gmail.com
Тема BUG #6512: Bug with prepared statement and timestamp + interval
Дата
Msg-id E1S3zcE-0004Rk-Fh@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #6512: Bug with prepared statement and timestamp + interval  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      6512
Logged by:          Stefano Baccianella
Email address:      stefano.baccianella@gmail.com
PostgreSQL version: 9.1.1
Operating system:   Windows 7 64bit
Description:=20=20=20=20=20=20=20=20

When trying to execute a query like:

SELECT * FROM table WHERE
timestamp_column > $1
AND timestamp_column < $1 + interval '1 hour'

There is no problems, but when executing

SELECT * FROM table WHERE
timestamp_column > $1 - interval '1 hour'
AND timestamp_column < $1 + interval '1 hour'

The database return a error saying the the operator timestamp > interval
does not exist.

Either the query

SELECT * FROM table WHERE
timestamp_column < $1 + interval '1 hour' AND timestamp_column > $1

Does not work

The $1 value is a timestamp (like now() for instance).

But the query
SELECT * FROM table WHERE timestamp_column =3D $1 OR (
timestamp_column > $1 - interval '1 hour'
AND timestamp_column < $1 + interval '1 hour')

works as expected.

It seems that the analyzer cannot guess the value of a prepared statement
combined with an interval. For my test i'm using PHP without PDO.

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

Предыдущее
От: maxim.boguk@gmail.com
Дата:
Сообщение: BUG #6513: explain (analyze, buffers) and toasted fields
Следующее
От: marko@kobaz.net
Дата:
Сообщение: BUG #6511: calling spi_exec_query from non-main package, results in: couldn't fetch $_TD