RE: [HACKERS] AUTOINDEXING AND HOROLOGY REGRESSION ERROR ON PGSQL 6.3, LINUX-ELF i686

Started by Jackson, DeJuanalmost 28 years ago1 messages
#1Jackson, DeJuan
djackson@cpsgroup.com

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@peanuts.roanoke.edu)

-DEJ