currval of sequence xxx_seq is not yet defined in this session?

From: kenyon <lqchenzjut(at)sina(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: currval of sequence xxx_seq is not yet defined in this session?
Date: 2013-01-06 09:57:34
Message-ID: 1357466254696-5738893.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

HI,everybody:

recently i found some errors in pg_log when i do some pressure testing,looks
like

"2013-01-05 21:48:29.870
CST,"postgres","wedding",15850,"172.25.10.28:37100",50e82f2d.3dea,1,"SELECT",2013-01-05
21:48:29 CST,19/80509,0,ERROR,55000,"currval of sequence
""t_wedding_wedding_id_seq"" is not yet defined in this session"
,,,,,," SELECT currval('t_wedding_wedding_id_seq')as weddingId
",,,""
2013-01-05 21:48:29.984
CST,"postgres","wedding",15856,"172.25.10.28:37123",50e82f2d.3df0,1,"SELECT",2013-01-05
21:48:29 CST,25/91770,0,ERROR,55000,"currval of sequence
""t_wedding_wedding_id_seq"" is not yet defined in this session"
,,,,,," SELECT currval('t_wedding_wedding_id_seq')as weddingId "

the code is

begin;
insert into t_wedding(wedding_id,share_id,share_type,user_id,wedding_time)
select nextval('t_wedding_wedding_id_seq')
,#ShareId#,#shareType#,#userId#,#weddingTime#
<selectKey resultClass="int" keyProperty="weddingId">
SELECT currval('t_wedding_wedding_id_seq')as weddingId
</selectKey>
;
COMMIT;

the column wedding_id type is serial + primary key, and i set the sequence
cache from 1 to 50,errors still exists,but reduced。

I use ibatis,but it seems not support returning wedding_id !!!

MY environment:
Postgres 9.1.2
ibatis
pgbouncer ( Transaction mode )
Postgres-9.1-901.jdbc4.jar as my drive

As i used *begin * to wrapped it as a transaction, then why zhe errors
still occurs ?

--
View this message in context: http://postgresql.1045698.n5.nabble.com/currval-of-sequence-xxx-seq-is-not-yet-defined-in-this-session-tp5738893.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message J. Hondius 2013-01-07 14:45:25 lc_time not working?
Previous Message Thomas Kellerer 2013-01-06 08:52:07 Re: Counterintuitive locking behavior