Search Postgresql Archives

timestamp literal out of line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while 
> boarding. Thank you for flying nlogn airlines.

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux