timestamp literal out of line

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема timestamp literal out of line
Дата
Msg-id 20100307123229.GB22191@svana.org
обсуждение исходный текст
Ответы Re: timestamp literal out of line
Список pgsql-general
Version: 8.3.9

I was surprised when I came across the following while changing some
code to send parameters out of line (to avoid interpolation).

postgres=# prepare test1 as select timestamp '2009-01-01';
PREPARE
postgres=# prepare test2 as select timestamp $1;
ERROR:  syntax error at or near "$1"

The workaround is simple, use a cast instead, but is there a particular
reason why you can't use a parameter there?

This does work, oddly enough.

postgres=# prepare test2 as select timestamp '2009-01-01' at time zone $1;
PREPARE

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

Вложения

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

Предыдущее
От: Chris
Дата:
Сообщение: Re: XML Index again
Следующее
От: Dimitri Fontaine
Дата:
Сообщение: Re: accessing the words in a full text index