Support for getNextAutoGeneratedValue impossible on postgresql
--------------------------------------------------------------

                 Key: GEOT-2231
                 URL: http://jira.codehaus.org/browse/GEOT-2231
             Project: GeoTools
          Issue Type: Bug
          Components: data jdbc-ng
    Affects Versions: 2.5.2
            Reporter: Andrea Aime
            Assignee: Justin Deoliveira
            Priority: Critical
             Fix For: 2.5.3


The code assumes it's ok to call the method before performing an insert, but 
generally speaking, that does not make sense, since the next pk value is yet to 
be generated. On H2 and SqlServer an access to the "curr" value is performed, 
which generates one if missing I guess?
But in postgis using currval to do the same results in an error:
"Return the value most recently obtained by nextval for this sequence in the 
current session. (An error is reported if nextval has never been called for 
this sequence in this session.) Notice that because this is returning a 
session-local value, it gives a predictable answer whether or not other 
sessions have executed nextval since the current session did. "

So it's not really possible to report back the values generated by a "serial" 
type in postgresql, as the function should be called _after_ the insert 
occurred.

Marked as critical since "serial" is the most common way to create a primary 
key.

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

        

------------------------------------------------------------------------------
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to