> which works from psql but fails with "bad parameter" from perl. If I> take out the "datetime::date AS date" bit it starts working.
Could you please post the exact bit of Perl code?