sequence newbie question - Mailing list pgsql-novice

From Kevin B.
Subject sequence newbie question
Date
Msg-id 33221.67.87.27.161.1101830243.squirrel@www.ke5in.com
Whole thread Raw
Responses Re: sequence newbie question
Re: sequence newbie question
List pgsql-novice
Hi,

I'm coming over from the MS sql server world and I've been reading up on
sequences. I have a question:

I see that you can create an implicit sequence like this:
CREATE TABLE test (field varchar(5), id serial NOT NULL, PRIMARY KEY (id));

And I've read that you can replace the Microsoft @@Identity by using this:
select last_value from test_id_seq;

But what if somebody else inserts a row after your insert but before your
select? Will you end up with their ID or is the "last_value" somehow
associated with the connection?

Thanks,
Kevin


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: problematic upgrade
Next
From: Tom Lane
Date:
Subject: Re: views with parameters