Re: Bug with PreparedStatements using EXTRACT function - Mailing list pgsql-jdbc

From Maciek Sakrejda
Subject Re: Bug with PreparedStatements using EXTRACT function
Date
Msg-id CAH_hXRY4uCLT9=MJ211Kmu8sLhe4jJ9Ur9M16=aHRfTRQyx18w@mail.gmail.com
Whole thread Raw
In response to Bug with PreparedStatements using EXTRACT function  (Matthias Böhm <fliegenblues@gmx.net>)
List pgsql-jdbc
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

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Maven based build and refactoring
Next
From: Maciek Sakrejda
Date:
Subject: Re: oid int issue with CachedRowSet upgrading from JDBC 8.4 to 9.1