Re: sequence help

From: Ragnar <gnari(at)hive(dot)is>
To: Matthew Peter <survivedsushi(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: sequence help
Date: 2006-11-28 10:10:52
Message-ID: 1164708652.27070.155.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message George Weaver 2006-11-28 10:25:46 Re: A generic trigger to log chanes on database tables
Previous Message Alban Hertroys 2006-11-28 10:01:22 Re: sequence help