persistence@glassfish.java.net

Re: Your last post for bug 3218

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Wed, 12 Sep 2007 09:40:27 -0700

And one more note:

> You can add to it that it's possible to get the "current" sequence number
> by doing "SELECT last_value FROM sequence_name". However, this is not
> transaction-safe and can result in race conditions.

Regards,
-marina

Marina Vatkina wrote:
> Andrei,
>
> This is the answer that we got from our PostgreSQL expert:
>
>> The issue is that "CURRVAL" is only defined if there's been a previous
>> sequence call (usually a NEXTVAL) in the same transaction or session.
>> If you
>> try to call CURRVAL without having called NEXTVAL/SETVAL, you get an
>> error
>> message similar to yours.
>>
>> I beleive this is the way Oracle also behaves, and may even be defined
>> in the
>> SQL spec.
>
>
> Regards,
> -marina
>
> Andrei Ilitchev wrote:
>
>> PostgreSQL experts out there, could you please take a look at
>> https://glassfish.dev.java.net/issues/show_bug.cgi?id=3218, in
>> particular the
>> third posting from the end.
>>
>> Why could the following jdbc call: "select
>> currval('t_information_recipient_ircp_id_seq')" cause: "Internal
>> Exception:
>> org.postgresql.util.PSQLException: ERROR: currval of sequence
>> "t_information_recipient_ircp_id_seq" is not yet defined in this session"
>>
>> How to avoid the problem?
>>
>> Thanks,
>>
>> Andrei
>>
>> ----- Original Message ----- From: "Oliver Walczak"
>> <oliver.walczak_at_momatec.de> To: <ailitche_at_dev.java.net> Sent: Wednesday,
>> September 05, 2007 3:58 AM Subject: Your last post for bug 3218
>>
>>
>>> Dear ailitche,
>>>
>>> please excuse me to give you the response directly to your eMail
>>> adress but
>>> what I wanted to tell you does not belong into an issue tracking
>>> system. I
>>> want you to understand that I am far off of plain jdbc programming or
>>> having the time to test around the teamplay of glassfish and
>>> postgres. I am
>>> simply watching out for the new techniques coming up these days with
>>> EJB3
>>> and I am seriously claimed to use the new reference implementation of
>>> glassfish2 in our upcoming projects and products. As I am directed to
>>> postgres this is the interface I am testing out. But the only thing I
>>> can
>>> do is tell you that the one or the other thing is not working
>>> correctly or
>>> not alike specified. And you can imagine that problems with the serial
>>> generation shop up increasingly onward the development phase.
>>>
>>> So besides that I did not fully understand your remarks in the last post
>>> and with the maximum respect for your knowledge and your work, I am
>>> certainly the wrong person to correct or fix those things. I would
>>> rather
>>> expect that some programmer like you would set up a small example
>>> like mine
>>> posted in the inital bug message, test the whole thing out and fix
>>> PostgreSQLPlatform.java until the sequence generation with custom
>>> sequence
>>> mapping works. You are about to release GF2 in short future, so why not
>>> spending this known issue one hour or two to correct it. There are
>>> certainly more people like me designing and requesting the
>>> combination of
>>> the best open source JEE5 platform with the best open source database
>>> out
>>> there.
>>>
>>> With my kindest regards, Oliver
>>>