-- Firstly, remove PRIMARY KEY attribute of former PRIMARY KEY
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;
-- Then change column name of your PRIMARY KEY and PRIMARY KEY candidates properly.
ALTER TABLE <table_name> RENAME COLUMN <primary_key_candidate> TO id;
-- Lastly set your new PRIMARY KEY
ALTER TABLE <table_name> ADD PRIMARY KEY (id);
I'd recommend having some Unique Index backing up the Primary Key before deleting it.
Imagine querying a large table on Production, with millions of rows where the queries depend on the Primary Key (PK) to run efficiently, but suddenly the PK is gone. The queries will pay a high penalty, considering that recreating the PK will take some time depending on the table's size.
Also, always consider creating indices with the CONCURRENTLY option, so the table is not locked.