PostGISAutoIncrementFIDMapper may return incorrect values
---------------------------------------------------------

                 Key: GEOT-1052
                 URL: http://jira.codehaus.org/browse/GEOT-1052
             Project: GeoTools
          Issue Type: Bug
          Components: data postgis
    Affects Versions: 2.3.M0, 2.2.1
            Reporter: Andrea Aime
         Assigned To: Justin Deoliveira
             Fix For: 2.4


PostGISAutoIncrementFIDMapper assumes that select currvalue from sequence will 
return the last value generated during the current transaction, but in a 
configuration where the transaction isolation level is READ_COMMITTED this may 
be the value generated and committed by another transaction before the select 
currvalue occurs (see 
http://www.postgresql.org/docs/current/static/transaction-iso.html#XACT-READ-COMMITTED).

Afaik the proper way to gather values generated with an auto-increment column 
is to use Statement.getGeneratedKeys, provided by JDBC 3. Unfortunately it 
seems it's not supported by the postgres jdbc driver due to a limitation in the 
postgres own communication protocol.

Searching on ml they do suggest to perform inserts and select currval in the 
same sql statement:
"insert into xxxx; select currval() from sequence"

Bleah, not much we can do about it, but we may want to support direct sequence 
fid mappers, that is, a table with a numeric primary key, not serial, and a 
separate known sequence to be used as a generator to be called before inserting 
data. This is the way Hibernate supports primary keys in Oracle and Postgres.

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

        

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to