mdr wrote > I had a question on creating PK with alter table, after table is created. > > I understand I create a PK id during create table by stating id as > follows: > id serial primary key > > It implicitly creates index and the sequence testing_id_seq to be > associated with the id field. > I can list the sequence with \ds. "PRIMARY KEY" implicitly creates an index "serial" (i.e., the column type) implicitly creates a sequence (of type integer; bigserial creates a biginteger sequence) psuedo-sql: CREATE TABLE a (id serial); ALTER TABLE a ADD CONSTRAINT PRIMARY KEY (id); The first creates the serial; the second creates the index and unique constraint. Should be equivalent to: CREATE TABLE a (id serial PRIMARY KEY); David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Creating-Primary-Key-after-CREATE-TABLE-Is-Sequence-created-tp5772633p5772636.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general