Skip site navigation (1) Skip section navigation (2)

Using nextval(seq) in more than one column

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Postgres Newbie <pgsql-novice(at)postgresql(dot)org>
Subject: Using nextval(seq) in more than one column
Date: 2007-10-10 12:18:33
Message-ID: 470CC319.7020602@mail.nih.gov (view raw or flat)
Thread:
Lists: pgsql-novice
I am trying to design some tables that have keys that look like:

ASDF-####

where #### should be derived from a sequence.  However, I would like the 
primary key to be an integer for speed of indexing, etc.  I don't see a 
way using standard DDL followed by inserts to have the #### be the same 
number as the integer primary key.  Is that the case?

In other words, I would like the rows to look like:

1   ASDF-1   ....
2   ASDF-2   ....

Thanks,
Sean

Responses

pgsql-novice by date

Next:From: A. KretschmerDate: 2007-10-10 12:42:21
Subject: Re: Using nextval(seq) in more than one column
Previous:From: Jim StalewskiDate: 2007-10-09 20:55:29
Subject: Re: is my pgsql 32 or 64 bit?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group