Re: sequence in select

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: sequence in select
Дата
Msg-id BC39FD09-712B-45BD-8D7D-2CF94FB62745@pervasive.com
обсуждение исходный текст
Ответ на sequence in select  ("SunWuKung" <Balazs.Klein@t-online.hu>)
Список pgsql-general
On Jun 22, 2006, at 9:10 AM, SunWuKung wrote:
> Hi,
> I put the following into a function. Is this always going to give me a
> sequence with an increment of 1 independently from other transactions?
> If not what would be the standard way to return a sequence from a
> query?
>
> CREATE TEMPORARY SEQUENCE rank_seq;
> SELECT nextval('rank_seq') FROM whatever ORDER BY id;
> DROP SEQUENCE rank_seq;

That will do what you want.
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Out of memory error in 8.1.0 Win32
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Out of memory error in 8.1.0 Win32