“But this adds the column at the end…” – column order in the table definition is unreliable; when you output you should specify the column order yourself. As to populating within a sequence that has missing values that is more trouble than it is worth. If you want to add a column and make it the primary key you need to indicate such in your ALTER TABLE statement by adding “PRIMARY KEY” to the end of it: “ALTER TABLE t ADD COLUMN c serial PRIMARY KEY” If you really feel you need to do as you explain I would advise giving more context as to what and why you are doing that so alternative solutions can be presented. David J From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Adarsh Sharma Dear all, |