Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: [JDBC] setting PreparedStatement parameter using "at time zone interval ?"

From: Tom Lane <tgl(at)sss.pgh.pa.us>
Date: Wed Dec 19 2007 - 10:48:45 EST


"Matt Magoffin" <postgresql.org@msqr.us> writes:
> I'm using the latest 8.3 development driver against an 8.3 database. I
> thought back in 8.1 I used to be able to use a PreparedStatement that
> included something like
> ... date(l.created AT TIME ZONE INTERVAL ?)

That might've worked back before the driver did real prepared statements. It's invalid syntax though, because typename before the constant works only for simple literal string constants. You got away with it when the driver interpolated parameter values into the query as string literals, but you can't do it anymore.

?::interval (or the full-blown CAST syntax) is the right way.

See
http://developer.postgresql.org/pgdocs/postgres/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS particularly 4.1.2.5.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings Received on Wed Dec 19 10:50:15 2007

This archive was generated by hypermail 2.1.8 : Wed Jun 18 2008 - 23:41:43 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library