sequence help

From: Matthew Peter <survivedsushi(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: sequence help
Date: 2006-11-28 09:12:09
Message-ID: 466751.40626.qm@web35203.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Peters 2006-11-28 09:13:03 Problem with unique key
Previous Message Alban Hertroys 2006-11-28 08:34:44 Re: Why overlaps is not working