Dear Tom, it works only in psql, it does not work when you talk to the server using postgresql protocol. That is my point.
e.g. in the following code the query causes Syntax error (see the text in red). That means it does not work. Interestingly, when I use $4::timestamp or CAST ( $4 as TIMESTAMP ) the syntax error does not occur.
"INSERT INTO public.contest (contest_id, period_id, contest_name, start_ts, end_ts, default_format, status ) "
+ "VALUES ($1, $2, $3, TIMESTAMP $4, TIMESTAMP $5, $6, 'NEW' ) RETURNING contest_key",