sequence help - Mailing list pgsql-general

From Matthew Peter
Subject sequence help
Date
Msg-id 466751.40626.qm@web35203.mail.mud.yahoo.com
Whole thread Raw
Responses Re: sequence help  (Alban Hertroys <alban@magproductions.nl>)
Re: sequence help  (Ragnar <gnari@hive.is>)
List pgsql-general
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.

This is obviously a simplified example for an larger query dependent on row order
integrity in a view.

On http://www.postgresql.org/docs/8.1/interactive/functions-sequence.html I did not
find any way to avoid updating sequences (albeit they are supposed to update by
design and may need to update in order to pull the next in sequence). Nor was I able
to maintain iteration in a nextval()-like function. Any ideas?

Matt



____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Why overlaps is not working
Next
From: "Greg Peters"
Date:
Subject: Problem with unique key