Postgres EPSG factory won't work against Postgres 8.3
-----------------------------------------------------

                 Key: GEOT-2363
                 URL: http://jira.codehaus.org/browse/GEOT-2363
             Project: GeoTools
          Issue Type: Bug
          Components: core referencing
    Affects Versions: 2.5.3
            Reporter: Andrea Aime
            Assignee: Martin Desruisseaux
             Fix For: 2.5.4


Most prepared statements in DirectEpsqFactory and AuthorityCodes won't work 
against PostgreSQL 8.3 due to a type mismatch: the official EPSG database sql 
script creates primary keys (xxx_code) as integer columns, but the statements 
are prepared with setString instead. 
This mismatch usually just disables index usage (on most databases) as it 
forces the integer column to be "promoted" to a string, but in the case of 8.3 
it actually triggers the following error:

{code}
...
Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: 
integer = character varying
        at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1525)
        at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309)
        at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:258)
...
{code}

The fix is easy, the keys are actually numbers, so using setInt(index, 
Integer.valueOf(code)) makes the postgres factory work again

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to