From: | "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com> |
---|---|
To: | postgres(at)peanuts(dot)roanoke(dot)edu, PostgreSQL HACKERS List <pgsql-hackers(at)hub(dot)org> |
Cc: | PostgreSQL Questions Mailing List <pgsql-questions(at)postgreSQL(dot)org> |
Subject: | RE: [HACKERS] AUTOINDEXING AND HOROLOGY REGRESSION ERROR ON PGSQL 6.3, LINUX-ELF i686 |
Date: | 1998-03-16 21:51:46 |
Message-ID: | F10BB1FAF801D111829B0060971D839F18D396@dal_cps.cpsgroup.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Redirected to Questions list. (It is cool to say that.)
> -----Original Message-----
> hello all,
>
> yep, i'm new to postgres so please bare with me. if this isn't the
> correct place to ask these questions, please point me in the right
> direction.
I know how you feel.
> first and foremost,
>
> i need to have a field (say pin) that is the primary key of a given
> relation. each time a record gets added to this relation, the pin
> increases by 1. thus making an auto increasing primary key (i.e. a
> unique identifier for each record that isn't explicitly increased by
> 1,
> the dbms does it for me.)
What you are looking for is a sequence. Try
man create_sequence (or '\h create sequence' in psql).
ex.
create sequence myseq start 0 minvalue 0 cycle;
create table mytbl (
mykey int4 default nextval('myseq') primary key,
mydata1 varchar(20),
...);
when you do an insert you'll have to explicitly skip mykey.
ex.
insert into mytbl(mydata1, ...)
values ('Hello, world');
> second,
>
> i have a platform related installation question, which list should be
> used.
I'll let someone else answer this on from fear of being wrong.
> thankx,
>
> -brian (postgres(at)peanuts(dot)roanoke(dot)edu)
>
-DEJ
From | Date | Subject | |
---|---|---|---|
Next Message | David Gould | 1998-03-16 23:27:02 | Re: [HACKERS] Re: [PATCHES] patches for 6.2.1p6 |
Previous Message | Dwayne Bailey | 1998-03-16 21:22:46 | Alpha initdb fixed! |