Have you looked at the serial type?
This type creates an explicity sequence with a predictable name:
and has a default value that selects the next val from that sequence.
You can get the value of the most recently inserted row in your session
Hope this helps :)
On Saturday, July 21, 2001, at 10:04 AM, Dado Feigenblatt wrote:
> Josh Berkus wrote:
>> Maybe we're looking at this the hard way. Have you thought of simply
>> putting in a DATETIME column and sorting by that?
> Sorting? I might have expressed myself wrong.
> I'm not concerned about sorting.
> I'm concerned about giving rows in a single table an unique, sequential
> numbered ID
> based on a sequence per project (as in a serial counter, as in 'create
> sequence specific_project_sequence;')
> rows related to project A get a number from sequence A
> rows related to project B get a number from sequence B
> Is it clear now, or is it me who's not understanding what you're saying?
> Sorry for the confusion.
> -- Dado Feigenblatt Wild Brain, Inc.
> Technical Director (415) 553-8000 x???
> dado(at)wildbrain(dot)com San Francisco, CA.
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
Australia's Premier Internet Broadcasters
Phone: +612 9357 1699
Fax: +612 9357 1169
The Inspire Foundation is proudly supported by Net Ventures through the
provision of streaming solutions for it's national centres. The Inspire
Foundation is an Internet-based foundation that inspires young people to
help themselves, get involved and get online. Please visit Inspire at
In response to
pgsql-sql by date
|Next:||From: Ed Yu||Date: 2001-07-21 05:50:57|
|Subject: Re: When PostgreSQL compliant JDBC 2.0?|
|Previous:||From: Dado Feigenblatt||Date: 2001-07-21 00:04:47|
|Subject: Re: nextval on insert by arbitrary sequence|