PostgreSQL DBMS Server Question (newbie stuff)

Ok, I hate not knowing basic stuff, but you gotta start someplace, right?

The question is this: I’m creating a table with a number of fields, one of which is an integer Primary Key. Is there a way to make the server automatically assign a unique number every time a record is added? I don’t want to have to write a subroutine into my front-end that figures out what the highest Key value is then increment.

So…Any help available? I’ve searched the man pages, the packaged help, usenet, etc and no luck.

Thanks in advance.

When you create the table, make sure you set the auto-increment property for that field.

CREATE TABLE Foo (primkey int auto_increment, otherfield int, yet_another_field blob);

oughta do it.

Thanks for the input friedo. It didn’t work, but searching on your answer I found what I was looking for.

Now if I could only figure out how to insert a null date into a date field without returning an error…!#&!@^!@@#