sequence newbie question

Поиск
Список
Период
Сортировка
От Kevin B.
Тема sequence newbie question
Дата
Msg-id 33221.67.87.27.161.1101830243.squirrel@www.ke5in.com
обсуждение исходный текст
Ответы Re: sequence newbie question
Re: sequence newbie question
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: problematic upgrade
Следующее
От: Tom Lane
Дата:
Сообщение: Re: views with parameters