working with sequences

From: Alex Ott <ott(at)jet(dot)msk(dot)su>
To: pgsql-sql(at)postgresql(dot)org
Subject: working with sequences
Date: 2002-01-31 10:43:23
Message-ID: ht2u1t2ssvo.fsf@seal.service.jet.msk.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello

I have some troubles when work with sequences. I porting code from oracle
to pgsql, adding suppport for new database.

I start one big transaction where i insert many records in various tables.
Most of inserts look like:

insert into rfc822_address (id, addr_spec, personal, adl, error)
values (nextval('rfc822_address_seq'), ?, ?, ?, ?)

and after insert i need get current value of sequence
'rfc822_address_seq'. I do this with

select currval('rfc822_addr_spec_seq')

but sometimes this query return none and my programm crash. This offten
happen after 2-3 call of nextval

Is anybody can help me?

--
With best wishes, Alex Ott
Jet Infosystems

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tod McQuillin 2002-01-31 12:31:58 Re: How to merge several attributes and Delete an attribute
Previous Message Christopher Kings-Lynne 2002-01-31 07:57:12 Re: How to merge several attributes and Delete an attribute