PostGIS createSchema method fails when asked to represent a String.class
------------------------------------------------------------------------

                 Key: GEOT-1348
                 URL: http://jira.codehaus.org/browse/GEOT-1348
             Project: GeoTools
          Issue Type: Bug
          Components: data postgis
    Affects Versions: 2.4-M3, 2.3.1
         Environment: This problem was reported against 2.3.1 with postgresql + 
postgis 8.2.
            Reporter: Jody Garnett
            Assignee: Jody Garnett
            Priority: Minor


Thanks to Enam for the original report :-D

Apparently we are asking for the max integer value which is a little bit more 
that the legal limit.

{code}
    public static void main(String[] args) throws Exception
     {   
         Map params = new HashMap();
         params.put("dbtype", "postgis");        //must be postgis
         params.put("host", "localhost");        //the name or ip address of 
the machine running PostGIS
         params.put("port", new Integer(5432));  //the port that PostGIS is 
running on (generally 5432)
         params.put("database", "postgres");      //the name of the database to 
connect to.
         params.put("user", "postgres");         //the user to connect with
         params.put("passwd", "pass");               //the password of the user.
                                                                                
                                      
         DataStore pgDatastore = DataStoreFinder.getDataStore(params);          
                                      
         pgDatastore.createSchema(someSchema);
}
{code}

Results in the following message:
* java.io.IOException: ERROR: length for type varchar cannot exceed 10485760

This issue is marked *minor* as you can work around it by actually mentioning 
the string length:
{code}
// bad
AttributeType cgi = AttributeTypeFactory.newAttributeType("propertyName", 
String.class);
// good
AttributeType cgi = AttributeTypeFactory.newAttributeType("propertyName", 
String.class, true, 30);
{code}
Long term I would like to see datastores provide their own FeatureTypeFactory 
so this kind of thing is not a problem ever again (and we can be sure that the 
GeoTools FeatureType is always a representation of what the data store can 
support).

-- 
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

        

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to