That's because the 'date' is not a cast but some sort of type
specification inherent to the expression. I don't understand the
details of the grammar, but you can see this if you try to run it via
PREPARE (the closest language-level thing you can use to JDBC's
parameterized statements):
cqdb=# prepare foo(date) as select extract (year from date '2000-01-01');
PREPARE
cqdb=# prepare bar(date) as select extract (year from date $1);
ERROR: syntax error at or near "$1"
LINE 1: prepare bar(date) as select extract (year from date $1);
^
cqdb=# prepare baz(date) as select extract (year from $1);
PREPARE
cqdb=#
---
Maciek Sakrejda | System Architect | Truviso
1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com