X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F221FD7C14 for ; Sun, 6 Nov 2005 12:49:54 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71684-08 for ; Sun, 6 Nov 2005 16:49:53 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 83DA2D79D9 for ; Sun, 6 Nov 2005 12:49:53 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA6GnYUj025250; Sun, 6 Nov 2005 11:49:34 -0500 (EST) To: Dave Cramer Cc: William Harris , List Subject: Re: [Pgjdbc-commit] ERROR: syntax error at or near "$1" In-reply-to: <9475581B-E5F2-404C-84CC-7D3774B590BF@fastcrypt.com> References: <436E0CBC.3060507@dineco.com> <9475581B-E5F2-404C-84CC-7D3774B590BF@fastcrypt.com> Comments: In-reply-to Dave Cramer message dated "Sun, 06 Nov 2005 10:43:12 -0500" Date: Sun, 06 Nov 2005 11:49:34 -0500 Message-ID: <25249.1131295774@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/34 X-Sequence-Number: 14132 Dave Cramer 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