Re: sequence help

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: Matthew Peter <survivedsushi(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: sequence help
Date: 2006-11-28 10:01:22
Message-ID: 456C08F2.6080706@magproductions.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

And what would you expect to see if more than one person simultaneously
queries foobar? A sequence would increment for each session querying it.

I think you want numbers to increase per session, in which case you
could probably use generate_series().

Regards,
--
Alban Hertroys
alban(at)magproductions(dot)nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede

// Integrate Your World //

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ragnar 2006-11-28 10:10:52 Re: sequence help
Previous Message Greg Peters 2006-11-28 09:35:15 Re: Problem with unique key