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.