Re: pg_query_params() problem with date_trunc() (possibly other functions as well)
В списке pgsql-general по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: pg_query_params() problem with date_trunc() (possibly other functions as well) |
| Дата | |
| Msg-id | 1558.1400301722@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | pg_query_params() problem with date_trunc() (possibly other functions as well) (patrick keshishian <pkeshish@gmail.com>) |
| Ответы |
Re: pg_query_params() problem with date_trunc() (possibly
other functions as well)
|
| Список | pgsql-general |
patrick keshishian <pkeshish@gmail.com> writes:
> I started to look into using pg_query_params() with some
> php scripts, but ran into this issue where I get:
> PHP message: PHP Warning: pg_query_params(): Query failed: ERROR:
> invalid input syntax for type timestamp: "$1"
> LINE 1: ... date_trunc('day', now()), date_trunc('day', TIMESTAMP '$1')
You probably want just this:
... date_trunc('day', now()), date_trunc('day', $1)
or if that doesn't work, try this:
... date_trunc('day', now()), date_trunc('day', $1::timestamp)
The syntax TIMESTAMP '...' is only for plain literal constants.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера