From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dave Cramer <pg@fastcrypt.com>
Cc: William Harris <boggy@dineco.com>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: [Pgjdbc-commit] ERROR: syntax error at or near "$1"
Date: Sun, 06 Nov 2005 11:49:34 -0500
Message-ID: <25249.1131295774@sss.pgh.pa.us> (raw)
In-Reply-To: <9475581B-E5F2-404C-84CC-7D3774B590BF@fastcrypt.com>
References: <436E0CBC.3060507@dineco.com>
<9475581B-E5F2-404C-84CC-7D3774B590BF@fastcrypt.com>
Dave Cramer <pg@fastcrypt.com> writes:
> On 6-Nov-05, at 9:01 AM, William Harris wrote:
>> intervalStmt = con.prepareStatement( "select current_date +
>> (interval ?)" );
The above is not and never has been correct syntax; the fact that it
failed to fail in previous JDBC versions was accidental. The syntax
interval 'literal'
(or in general any type name followed by a string literal) is defined
to work only for literals. The correct way to do this is either
CAST(? AS interval) (SQL standard)
?::interval (Postgres-ism)
See
http://www.postgresql.org/docs/8.0/static/sql-syntax.html#SQL-SYNTAX-CONSTANTS
particularly the note at the end of section 4.1.2.5.
Fraid you're out of luck on the SET example though :-(
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: tgl@sss.pgh.pa.us, pg@fastcrypt.com, boggy@dineco.com
Subject: Re: [Pgjdbc-commit] ERROR: syntax error at or near "$1"
In-Reply-To: <25249.1131295774@sss.pgh.pa.us>
References: <436E0CBC.3060507@dineco.com> <9475581B-E5F2-404C-84CC-7D3774B590BF@fastcrypt.com> <25249.1131295774@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox