Re: 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: Re: currval of sequence xxx_seq is not yet defined in this session?
Date: 2013-01-09 01:58:00
Message-ID: 1357696680573-5739294.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for your reply!

yeath,I quite accept your opinion,once i guess the drive adds savepoint
between the two SQL,but not sure

i want to get the last insert id to ensure the INSERT correctly ,so i called
currval().

as the error occurs seldom,i find it's difficult to trace the problem or the
logic is doing exactly

later i modified the code looks like:
>select nexval('t_wedding_wedding_id_seq') as Wedding_id;
>insert into t_wedding(wedding_id...) select Wedding_id...;

and in the later pressure tesing never saw the error again.

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kirk Wythers 2013-01-09 02:15:52 Re: query by partial timestamp
Previous Message Tom Lane 2013-01-09 01:48:57 Re: Discerning when functions had execute revoked from public