Re: nextval on insert by arbitrary sequence

From: David Stanaway <david(at)netventures(dot)com(dot)au>
To: Dado Feigenblatt <dado(at)wildbrain(dot)com>, Pgsql-Sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: nextval on insert by arbitrary sequence
Date: 2001-07-21 04:30:17
Message-ID: 200107210431.OAA23816@lorica.ucc.usyd.edu.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Have you looked at the serial type?

This type creates an explicity sequence with a predictable name:
tblname_rowname_seq

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
with
CurrVal('tblname_rowname_seq')

Hope this helps :)

On Saturday, July 21, 2001, at 10:04 AM, Dado Feigenblatt wrote:

> Josh Berkus wrote:
>
>> Dado,
>>
>> Maybe we're looking at this the hard way. Have you thought of simply
>> putting in a DATETIME column and sorting by that?
>>
>> -Josh
>>
> 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;')
> e.g.
> 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
>

--
Best Regards
David Stanaway
================================
Technology Manager
Australia's Premier Internet Broadcasters
Phone: +612 9357 1699
Fax: +612 9357 1169
Web: http://www.netventures.com.au
Support: support(at)netventures(dot)com(dot)au
================================
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
http://www.inspire.org.au

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ed Yu 2001-07-21 05:50:57 Re: When PostgreSQL compliant JDBC 2.0?
Previous Message Dado Feigenblatt 2001-07-21 00:04:47 Re: nextval on insert by arbitrary sequence