Re: nextval on insert by arbitrary sequence
| От | David Stanaway | 
|---|---|
| Тема | Re: nextval on insert by arbitrary sequence | 
| Дата | |
| Msg-id | 200107210431.OAA23816@lorica.ucc.usyd.edu.au обсуждение исходный текст  | 
		
| Ответ на | Re: nextval on insert by arbitrary sequence (Dado Feigenblatt <dado@wildbrain.com>) | 
| Список | 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@wildbrain.com                               San Francisco, CA.
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.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@netventures.com.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
		
	В списке pgsql-sql по дате отправления: