FIDFactory wrongly skips if second column is auto-increment
-----------------------------------------------------------
Key: GEOT-1264
URL: http://jira.codehaus.org/browse/GEOT-1264
Project: GeoTools
Issue Type: Bug
Components: data versioning postgis
Affects Versions: 2.4.M2
Reporter: Chris Holmes
Assignee: Andrea Aime
Fix For: 2.4.M3
Different versions of PostGIS return different orders for primary key columns.
But the current code only check if the first column is an auto-increment one.
If it's the second it is wrongly skipped.
Patch is:
Index:
src/main/java/org/geotools/data/postgis/fidmapper/VersionedFIDMapperFactory.java
===================================================================
---
src/main/java/org/geotools/data/postgis/fidmapper/VersionedFIDMapperFactory.java
(revision 25399)
+++
src/main/java/org/geotools/data/postgis/fidmapper/VersionedFIDMapperFactory.java
(working copy)
@@ -98,7 +98,7 @@
protected FIDMapper buildSingleColumnVersionedFidMapper(String schema,
String tableName,
Connection connection, ColumnInfo[] colInfos) {
- if (colInfos[0].isAutoIncrement() && colInfos.length == 2) {
+ if (colInfos.length == 2 && (colInfos[0].isAutoIncrement() ||
colInfos[1].isAutoIncrement())){
return new VersionedAutoincrementFIDMapper(schema, tableName,
colInfos[0].colName,
colInfos[0].dataType, colInfos[0].decimalDigits);
} else if (isIntegralType(colInfos[0].dataType)) {
This is confirmed to fix the problem (using database on sigma.openplans.org,
where the problem first arose). Would like review, as I'm not 100% sure about
evaluation order, and if left is not checked first then this will make an error
on occasion. I suppose I also could have just nested the evaluation
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel