Search Postgresql Archives

Re: sequence in select

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux