Re: sequence help
| От | Ragnar |
|---|---|
| Тема | Re: sequence help |
| Дата | |
| Msg-id | 1164708652.27070.155.camel@localhost.localdomain обсуждение исходный текст |
| Ответ на | sequence help (Matthew Peter <survivedsushi@yahoo.com>) |
| Список | pgsql-general |
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
В списке pgsql-general по дате отправления: