Search Postgresql Archives

Re: sequence help

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

 



On þri, 2006-11-28 at 01:12 -0800, Matthew Peter wrote:
> I'll jump right in with an example
> 
> create sequence foo start with 1;
> 
> create view foobar as select *, nextval('foo') from bar;
> 
> The problem is I need a nextval()-like method that returns the iterations without
> updating the foo sequence. Therefore, maintaining the sequences original value by
> starting at 1 each time the foobar VIEW is invoked.

sounds like you do not really want sequences. (think of 
concurrent selects from such a view)

the most natural way to do this is in the application
layer, but if you have to do this in the backend, you
could do it with a pl/pgsql user defined set returning
function, I guess.

gnari




[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